Skip to content

Commit

Permalink
Fix DeprecationWarning fs.rmdir (take 2) (#9044)
Browse files Browse the repository at this point in the history
* Use fs.rm only if available

Co-authored-by: Fraser Waters <fraser@pulumi.com>
  • Loading branch information
jitbasemartin and Frassle committed Feb 25, 2022
1 parent 94de6e6 commit 05a3eb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG_PENDING.md
@@ -1,3 +1,6 @@
### Improvements

### Bug Fixes
### Bug Fixes

- [sdk/nodejs] - Fix Node `fs.rmdir` DeprecationWarning for Node JS 15.X+
[#9044](https://github.com/pulumi/pulumi/pull/9044)
8 changes: 7 additions & 1 deletion sdk/nodejs/automation/stack.ts
Expand Up @@ -825,6 +825,12 @@ const cleanUp = async (logFile?: string, rl?: ReadlineResult) => {
}
if (logFile) {
// remove the logfile
fs.rmdir(path.dirname(logFile), { recursive: true }, () => { return; });
if(fs.rm) {
// remove with Node JS 15.X+
fs.rm(path.dirname(logFile), { recursive: true }, () => { return; });
} else {
// remove with Node JS 14.X
fs.rmdir(path.dirname(logFile), { recursive: true }, () => { return; });
}
}
};

0 comments on commit 05a3eb7

Please sign in to comment.