Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
ensure fs deletes are not cwd dependent (elastic#59570)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <[email protected]>
  • Loading branch information
Spencer and spalger committed Mar 6, 2020
1 parent 7f75006 commit a1ba603
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cli_plugin/install/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function cleanPrevious(settings, logger) {

logger.log('Found previous install attempt. Deleting...');
try {
del.sync(settings.workingPath);
del.sync(settings.workingPath, { force: true });
} catch (e) {
reject(e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/install/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function install(settings, logger) {

await extract(settings, logger);

del.sync(settings.tempArchiveFile);
del.sync(settings.tempArchiveFile, { force: true });

existingInstall(settings, logger);

Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/remove/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function remove(settings, logger) {
}

logger.log(`Removing ${settings.plugin}...`);
del.sync(settings.pluginPath);
del.sync(settings.pluginPath, { force: true });
logger.log('Plugin removal complete');
} catch (err) {
logger.error(`Unable to remove plugin because of error: "${err.message}"`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class HeadlessChromiumDriverFactory {
logger.debug(`deleting chromium user data directory at [${userDataDir}]`);
// the unsubscribe function isn't `async` so we're going to make our best effort at
// deleting the userDataDir and if it fails log an error.
del(userDataDir).catch(error => {
del(userDataDir, { force: true }).catch(error => {
logger.error(`error deleting user data directory at [${userDataDir}]: [${error}]`);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function clean(dir: string, expectedPaths: string[]) {
const path = resolvePath(dir, filename);
if (!expectedPaths.includes(path)) {
log(`Deleting unexpected file ${path}`);
await del(path);
await del(path, { force: true });
}
});
}

0 comments on commit a1ba603

Please sign in to comment.