-
Notifications
You must be signed in to change notification settings - Fork 94
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
Dir is not cleaned when I hit ctrl+c #121
Dir is not cleaned when I hit ctrl+c #121
Comments
@JanBednarik Please provide additional information: OS, tmp version, node version etc. Could you also give us a link to your repository, so that we may look at the code directly? |
@JanBednarik ping |
Versions: Should cleanup work with ctrl+c? Maybe it's somehow related to Jest test runner. I'll try to prepare some simple failing case. |
@silkentrance Here is an example: File:
File:
Run:
And interrupt the test with ctrl+c. |
@JanBednarik thank your very much. I think that I have found the problem. There exists a SIGINT event and tmp should be listening on that, too. The only problem is that under Windows one must take a different approach. I will look into this. |
This package might be helpful. It's supposed to allow you to run code no matter how the process exits. It has Windows tests so presumably it works on Windows too. |
@davidshepherd7 the package looks good. I will try that. |
@davidshepherd7 I tried signal-exit, but to no avail so far. In addition, it also installs listeners for SIGHUP which I believe is not what we want as most user code uses this to implement some way of applying changes to the configuration etc. And we do not want to clean up existing tmp files or directories prematurely. |
@JanBednarik perhaps you want to try the https://github.com/raszi/node-tmp/tree/gh-121 branch If you do not know already, you can configure the tmp dependency so that it will point to that branch. See https://docs.npmjs.com/files/package.json#git-urls-as-dependencies and https://docs.npmjs.com/files/package.json#github-urls for more information. I would appreciate it if you'd provide us with a report of your experience with that branch. |
@JanBednarik since you are using jest, the branch also incorporates a fix for the problem with jest's inband sandboxing and tmp installing its process.exit listeners multiple times. See #129 and #125. |
same problem, Also using a custom dir, postfix and prefix. |
The provided branch |
@JanBednarik @cythrauL @davidshepherd7 the current solution, which calls upon process.exit(0) needs to be revised. Upon SIGINT the process should at least exist with a non zero (0) exit code. |
I have added one more commit to fix the tests for this issue. They seem to work, at least under OS X. |
Tests work fine on travis, but fail on appveyor. It seems as if the tests do not terminate the external processes as one would expected. Fricking windows platform. |
Any update ? |
We could do it ourselves if tmp exposed method like |
The fix in branch gh-121 is working, however, the tests will not work under windows as we are having problems with simulating the CTRL-C there. And there are some conflicts that need to be resolved first prior to merging this to master. If I find the time, I can at least prepare everything so that it can be merged to master, disabling the tests on windows for now. |
I am giving up on support for SIGINT on Windows. This platform just sucks as node will never And I am not inclined to add any support for invoking a "PowerShell" script that will terminate the external process in our tests. The current state is that it will work fine on both OSX and Linux. |
On travis the tests for this still fail, locally (OSX) they will succeed, working on that issue. |
dropping support for node v6.x as it is not working correctly with the installed SIGINT handlers
dropping support for node v6.x as it is not working correctly with the installed SIGINT handlers add appveyor build for node 11
dropping support for node v6.x as it is not working correctly with the installed SIGINT handlers add appveyor build for node 11
I'm using tmp package in unit tests with
tmp.setGracefulCleanup();
. I'm creating temp directory for tests withunsafeCleanup = true
.It works fine if I don't hit ctrl+c to interrupt tests. Then the temp dir is not deleted. How can I get it deleted automatically in this case?
The text was updated successfully, but these errors were encountered: