-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: ensure that fd 0-2 are valid on windows #11863
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import os | ||
import sys | ||
import subprocess | ||
os.close(0) | ||
os.close(1) | ||
os.close(2) | ||
cmd = sys.argv[1] + ' -e "process.stdin; process.stdout; process.stderr;"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would prefer it if the arguments came from the test file, i.e. you just spawn There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you do use -e, write this as |
||
exit_code = subprocess.call(cmd, shell=False) | ||
sys.exit(exit_code) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,16 @@ const common = require('../common'); | |
const assert = require('assert'); | ||
const spawn = require('child_process').spawn; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
if (common.isWindows) { | ||
common.skip('platform not supported.'); | ||
const python = process.env.PYTHON || 'python'; | ||
const script = path.join(__dirname, '..', 'fixtures', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'spawn_closed_stdio.py'); | ||
const proc = spawn(python, [ script, process.execPath ]); | ||
proc.on('exit', common.mustCall(function(exitCode) { | ||
assert.strictEqual(exitCode, 0); | ||
})); | ||
return; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the appropriate C++-style cast here, whichever one that is?