-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
child_process: support options in send()
This commit adds an options object to process.send(). The same object is propagated to process._send(), the _handleQueue, and the send() and postSend() functions of the handle converter. Fixes: #4271 PR-URL: #5283 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- Loading branch information
1 parent
01c331e
commit 6d4887c
Showing
4 changed files
with
66 additions
and
17 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
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,25 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const cp = require('child_process'); | ||
|
||
function noop() {} | ||
|
||
function fail(proc, args) { | ||
assert.throws(() => { | ||
proc.send.apply(proc, args); | ||
}, /"options" argument must be an object/); | ||
} | ||
|
||
let target = process; | ||
|
||
if (process.argv[2] !== 'child') | ||
target = cp.fork(__filename, ['child']); | ||
|
||
fail(target, ['msg', null, null]); | ||
fail(target, ['msg', null, '']); | ||
fail(target, ['msg', null, 'foo']); | ||
fail(target, ['msg', null, 0]); | ||
fail(target, ['msg', null, NaN]); | ||
fail(target, ['msg', null, 1]); | ||
fail(target, ['msg', null, null, noop]); |