This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
path.resolve argv[1] for non-default entrypoint. fixes #671
- Loading branch information
1 parent
e736f85
commit 3775ab6
Showing
5 changed files
with
46 additions
and
14 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
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,28 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
var path = require('path'); | ||
var spawn = require('child_process').spawn; | ||
|
||
if (process.send) { | ||
require('./test-spawn-a-child.js'); | ||
return; | ||
} | ||
|
||
var child = spawn( | ||
process.argv[0], [ | ||
path.join(process.cwd(), path.basename(__filename)), 'argvx', '--argvy' | ||
], { stdio: [ 'inherit', 'inherit', 'inherit', 'ipc' ] } | ||
); | ||
|
||
child.on('message', function (value) { | ||
console.log(value.toString()); | ||
child.send(value); | ||
}); | ||
|
||
child.send(2); | ||
|
||
child.on('exit', function (code) { | ||
console.log('Child exited with code', code); | ||
}); |