-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This requires that onExit() is not called immediately upon receiving a SIGCHLD. There could still be data in the pipez. So, instead just set a flag and invoke the pipe watchers. Sometimes one will not receive an EOF from pipes because the process was killed by a SIGTERM, or something. If SIGCHLD has been recved but we are getting EAGAIN, the pipez need to be closed too.
- Loading branch information
Showing
3 changed files
with
113 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
include("mjsunit.js"); | ||
|
||
var pwd_called = false; | ||
|
||
function pwd (callback) { | ||
var output = ""; | ||
var process = new node.Process("pwd"); | ||
process.onOutput = function (s) { | ||
if (s) output += s; | ||
}; | ||
process.onExit = function(c) { | ||
assertEquals(0, c); | ||
callback(output); | ||
pwd_called = true; | ||
}; | ||
} | ||
|
||
|
||
function onLoad () { | ||
pwd(function (result) { | ||
print(result); | ||
assertTrue(result.length > 1); | ||
assertEquals("\n", result[result.length-1]); | ||
}); | ||
} | ||
|
||
function onExit () { | ||
assertTrue(pwd_called); | ||
} |