Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary file or directory not cleaned up when a task callback throws an error #30

Closed
mvila opened this issue Mar 12, 2021 · 1 comment · Fixed by #31
Closed

Temporary file or directory not cleaned up when a task callback throws an error #30

mvila opened this issue Mar 12, 2021 · 1 comment · Fixed by #31

Comments

@mvila
Copy link

mvila commented Mar 12, 2021

The temporary file or directory is not cleaned up when a task callback throws an error, which doesn't feel like the expected behavior to me.

Example:

const tempy = require('tempy');
const fs = require('fs');

let createdTempDirectory;

await tempy.directory.task(async (tempDirectory) => {
  createdTempDirectory = tempDirectory;
  throw new Error('Something went wrong');
});

fs.existsSync(createdTempDirectory); // => true
@sindresorhus
Copy link
Owner

Not intended behavior. Just an oversight.

// @Richienb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants