| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 68b23be commit d6da170
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4161,6 +4161,19 @@ inline void PlatformInit() { | |||
| 4161 | 4161 | } while (min + 1 < max); | |
| 4162 | 4162 | } | |
| 4163 | 4163 | #endif // __POSIX__ | |
| 4164 | + #ifdef _WIN32 | ||
| 4165 | + for (int fd = 0; fd <= 2; ++fd) { | ||
| 4166 | + auto handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); | ||
| 4167 | + if (handle == INVALID_HANDLE_VALUE || | ||
| 4168 | + GetFileType(handle) == FILE_TYPE_UNKNOWN) { | ||
| 4169 | + // Ignore _close result. If it fails or not depends on used Windows | ||
| 4170 | + // version. We will just check _open result. | ||
| 4171 | + _close(fd); | ||
| 4172 | + if (fd != _open("nul", _O_RDWR)) | ||
| 4173 | + ABORT(); | ||
| 4174 | + } | ||
| 4175 | + } | ||
| 4176 | + #endif // _WIN32 | ||
| 4164 | 4177 | } | |
| 4165 | 4178 | ||
| 4166 | 4179 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + import os | ||
| 2 | + import sys | ||
| 3 | + import subprocess | ||
| 4 | + os.close(0) | ||
| 5 | + os.close(1) | ||
| 6 | + os.close(2) | ||
| 7 | + exit_code = subprocess.call(sys.argv[1:], shell=False) | ||
| 8 | + sys.exit(exit_code) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,9 +3,21 @@ const common = require('../common'); | |||
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | const spawn = require('child_process').spawn; | |
| 5 | 5 | const fs = require('fs'); | |
| 6 | + const path = require('path'); | ||
| 6 | 7 | ||
| 7 | 8 | if (common.isWindows) { | |
| 8 | - common.skip('platform not supported.'); | ||
| 9 | + if (process.argv[2] === 'child') { | ||
| 10 | + process.stdin; | ||
| 11 | + process.stdout; | ||
| 12 | + process.stderr; | ||
| 13 | + return; | ||
| 14 | + } | ||
| 15 | + const python = process.env.PYTHON || 'python'; | ||
| 16 | + const script = path.join(common.fixturesDir, 'spawn_closed_stdio.py'); | ||
| 17 | + const proc = spawn(python, [script, process.execPath, __filename, 'child']); | ||
| 18 | + proc.on('exit', common.mustCall(function(exitCode) { | ||
| 19 | + assert.strictEqual(exitCode, 0); | ||
| 20 | + })); | ||
| 9 | 21 | return; | |
| 10 | 22 | } | |
| 11 | 23 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments