- Version:
v8.5.0 v10.0.0
- Platform:
Linux tio2 4.15.13-300.fc27.x86_64 #1 SMP Mon Mar 26 19:06:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: child_process
In the documentation for child_process.spawnSync it says that the status property of the returned object is of type <number> and it nowhere mentions that it may be null. However, the following script prints null (expected is 139):
'use strict';
var fs = require('fs');
var path = require('path');
var os = require('os');
var cp = require('child_process');
var dir = path.join(os.tmpdir(), `${Date.now()}`);
fs.mkdirSync(dir);
var name = 'test.cc';
var file = path.join(dir, name);
fs.writeFileSync(file, 'int main(){++*(int*)0;}');
cp.spawnSync('gcc', [file], {cwd: dir});
var files = fs.readdirSync(dir);
var output = files.find(file => file !== name);
var obj = cp.spawnSync(path.join(dir, output));
console.log(obj.status);
On windows it prints 3221225477 which is expected result on windows.
v8.5.0v10.0.0Linux tio2 4.15.13-300.fc27.x86_64 #1 SMP Mon Mar 26 19:06:57 UTC 2018 x86_64 x86_64 x86_64 GNU/LinuxIn the documentation for
child_process.spawnSyncit says that thestatusproperty of the returned object is of type<number>and it nowhere mentions that it may benull. However, the following script printsnull(expected is 139):On windows it prints
3221225477which is expected result on windows.