Skip to content

Commit

Permalink
fix: restore rimraf for puppeteer-core code (#9815)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Mar 9, 2023
1 parent 87147dc commit cefc4ea
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
31 changes: 29 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/puppeteer-core/package.json
Expand Up @@ -138,6 +138,7 @@
"extract-zip": "2.0.1",
"https-proxy-agent": "5.0.1",
"proxy-from-env": "1.1.0",
"rimraf": "4.4.0",
"tar-fs": "2.1.1",
"unbzip2-stream": "1.4.3",
"ws": "8.12.1"
Expand Down
5 changes: 3 additions & 2 deletions packages/puppeteer-core/src/node/BrowserFetcher.ts
Expand Up @@ -16,7 +16,7 @@

import {exec as execChildProcess} from 'child_process';
import {createReadStream, createWriteStream, existsSync, readdirSync} from 'fs';
import {chmod, mkdir, readdir, rm, unlink} from 'fs/promises';
import {chmod, mkdir, readdir, unlink} from 'fs/promises';
import * as http from 'http';
import * as https from 'https';
import * as os from 'os';
Expand All @@ -31,6 +31,7 @@ import createHttpsProxyAgent, {
HttpsProxyAgentOptions,
} from 'https-proxy-agent';
import {getProxyForUrl} from 'proxy-from-env';
import rimraf from 'rimraf';
import tar from 'tar-fs';
import bzip from 'unbzip2-stream';

Expand Down Expand Up @@ -412,7 +413,7 @@ export class BrowserFetcher {
existsSync(folderPath),
`Failed to remove: revision ${revision} is not downloaded`
);
await rm(folderPath, {recursive: true, force: true});
await rimraf(folderPath);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions packages/puppeteer-core/src/node/BrowserRunner.ts
Expand Up @@ -16,11 +16,12 @@

import * as childProcess from 'child_process';
import * as fs from 'fs';
import {rm} from 'fs/promises';
import * as path from 'path';
import * as readline from 'readline';
import {promisify} from 'util';

import rimraf from 'rimraf';

import type {Connection as BiDiConnection} from '../common/bidi/bidi.js';
import {Connection} from '../common/Connection.js';
import {debug} from '../common/Debug.js';
Expand Down Expand Up @@ -124,7 +125,7 @@ export class BrowserRunner {
// Cleanup as processes exit.
if (this.#isTempUserDataDir) {
try {
await rm(this.#userDataDir, {recursive: true, force: true});
await rimraf(this.#userDataDir);
fulfill();
} catch (error) {
debugError(error);
Expand Down Expand Up @@ -238,7 +239,7 @@ export class BrowserRunner {
// Attempt to remove temporary profile directory to avoid littering.
try {
if (this.#isTempUserDataDir) {
fs.rmSync(this.#userDataDir, {recursive: true, force: true});
rimraf.sync(this.#userDataDir);
}
} catch (error) {}

Expand Down

0 comments on commit cefc4ea

Please sign in to comment.