-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
a couple tweaks to make things work on windows #5
Conversation
@bcoe is this still working? Is it done? |
🎉 |
@isaacs we're not running the test-suite on AppVeyor yet, so I just removed It would be nice to have some tests for https://gist.github.com/bcoe/574f20564e423375d0a6 I propose pulling this in, and then writing some targeted tests for |
@bcoe is Ubuntu the only Linux distribution you test with? Can't tell from your description if you mean the failure is distro specific or OS specific. |
@rmg I've only tested on my guess would be that I'd like to advocate getting the Windows fixes in, and then getting to the bottom of |
@bcoe This smells like a race condition to me. The process could be exiting before the signal can get to it. |
@@ -53,7 +53,7 @@ t.test('spawn execPath', function (t) { | |||
}) | |||
|
|||
t.test('exec shebang', function (t) { | |||
var child = cp.exec(fixture + ' xyz') | |||
var child = spawn(fixture, ['xyz']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be cp.exec.
The failures on Linux can probably be fixed with this diff:
diff --git a/test/fixtures/script.js b/test/fixtures/script.js
index 51f518a..ebc08f9 100755
--- a/test/fixtures/script.js
+++ b/test/fixtures/script.js
@@ -1,3 +1,5 @@
#!/usr/bin/env node
console.log('%j', process.execArgv)
console.log('%j', process.argv.slice(2))
+// keep the process open long enough to catch a signal
+setTimeout(function() {}, 500)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's not it.
Definitely something weird happening with signal-exit, it's sending the signal, but the exit happens with status 0, not the signal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, apparently signal-exit just straight up does not work on Linux. This is strange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See tapjs/signal-exit#15. It works fine, but exec() uses a real /bin/sh
on Linux, so a bunch of the tests gets weird results.
Close #5 Make this module work on Windows, and on >1 Unix system. This module needs way more testing, but honestly, since it's impossible to cover without having a spawn-wrap that can cover spawn-wrapping, it's really hard to even know where to begin. Thanks to @bcoe for repeatedly hammering on this to get it over the finish line.
I was able to simplify some of this, and make things a bit more stable, with fewer opportunities for false positives on some of the path tests, and one less Thanks for continuing to research and work on this! Tests all passing now on Windows, Darwin, and Ubuntu. |
A small PR in a small module, but the ripples this could have for testing node modules on Windows are very far reaching. |
c:\Program Files\node foo
->c:\node.cmd foo
c:\Program Files\node
->c:\node.cmd
.cmd
, along withcmd.exe
, this is the bin used bywin-spawn
.