()
| 253 | } |
| 254 | |
| 255 | function ChildProcess() { |
| 256 | FunctionPrototypeCall(EventEmitter, this); |
| 257 | |
| 258 | this._closesNeeded = 1; |
| 259 | this._closesGot = 0; |
| 260 | this.connected = false; |
| 261 | |
| 262 | this.signalCode = null; |
| 263 | this.exitCode = null; |
| 264 | this.killed = false; |
| 265 | this.spawnfile = null; |
| 266 | |
| 267 | this._handle = new Process(); |
| 268 | this._handle[owner_symbol] = this; |
| 269 | |
| 270 | this._handle.onexit = (exitCode, signalCode) => { |
| 271 | if (signalCode) { |
| 272 | this.signalCode = signalCode; |
| 273 | } else { |
| 274 | this.exitCode = exitCode; |
| 275 | } |
| 276 | |
| 277 | if (this.stdin) { |
| 278 | this.stdin.destroy(); |
| 279 | } |
| 280 | |
| 281 | this._handle.close(); |
| 282 | this._handle = null; |
| 283 | |
| 284 | if (exitCode < 0) { |
| 285 | const syscall = this.spawnfile ? 'spawn ' + this.spawnfile : 'spawn'; |
| 286 | const err = new ErrnoException(exitCode, syscall); |
| 287 | |
| 288 | if (this.spawnfile) |
| 289 | err.path = this.spawnfile; |
| 290 | |
| 291 | err.spawnargs = ArrayPrototypeSlice(this.spawnargs, 1); |
| 292 | this.emit('error', err); |
| 293 | } else { |
| 294 | this.emit('exit', this.exitCode, this.signalCode); |
| 295 | } |
| 296 | |
| 297 | // If any of the stdio streams have not been touched, |
| 298 | // then pull all the data through so that it can get the |
| 299 | // eof and emit a 'close' event. |
| 300 | // Do it on nextTick so that the user has one last chance |
| 301 | // to consume the output, if for example they only want to |
| 302 | // start reading the data once the process exits. |
| 303 | process.nextTick(flushStdio, this); |
| 304 | |
| 305 | maybeClose(this); |
| 306 | }; |
| 307 | if (childProcessChannel.hasSubscribers) { |
| 308 | childProcessChannel.publish({ |
| 309 | process: this, |
| 310 | }); |
| 311 | } |
| 312 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…