Skip to content

Status of the spawned process is null #20561

Description

@advanceddeveloper
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions