Created
May 29, 2016 10:47
-
-
Save saghul/161315261e5b4adcb741cb986cc76770 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
const assert = require('assert'); | |
const os = require('os'); | |
const sentinel = 4242; | |
var pid = os.fork(); | |
if (pid == 0) { | |
// child | |
assert.equal(sentinel, 4242); | |
} else { | |
// parent | |
assert.equal(sentinel, 4242); | |
var r = os.waitpid(pid, 0); | |
print(r); | |
assert.equal(r.pid, pid); | |
assert(os.WIFEXITED(r.status)); | |
assert.equal(os.WEXITSTATUS(r.status), 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment