Skip to content

Instantly share code, notes, and snippets.

@saghul
Created May 29, 2016 10:47
Show Gist options
  • Save saghul/161315261e5b4adcb741cb986cc76770 to your computer and use it in GitHub Desktop.
Save saghul/161315261e5b4adcb741cb986cc76770 to your computer and use it in GitHub Desktop.
'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