Skip to content
Myr

Fix processes not exiting on `inputFile` validation (#588)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 3ba748d · Browse files · 4 files+20 added−34 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+20 added−34 removed

  • tests:+2 added−0 removed
  • other:+18 added−34 removed

4 files+20 added−34 removed

modified:lib/stream.js+12 added-30 removed
modified:test/node.js+2 added
98 unmodified lines
99 subprocess.send('ping');100101 const message = await pEvent(subprocess, 'message');102 t.is(message, 'pong');103104 subprocess.kill();105});
modified:index.js+5 added-3 removed
8 unmodified lines
9import {makeError} from './lib/error.js';10import {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';11import {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';12import {addPipeMethods} from './lib/pipe.js';13import {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';13import {validateInputOptions, handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';14import {mergePromise, getSpawnedPromise} from './lib/promise.js';15import {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';16import {logCommand, verboseDefault} from './lib/verbose.js';17
63 unmodified lines
81 const escapedCommand = getEscapedCommand(file, args);82 logCommand(escapedCommand, parsed.options);8384 validateTimeout(parsed.options);85 validateInputOptions(parsed.options);8687 let spawned;88 try {89 spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
84 unmodified lines
174 const command = joinCommand(file, args);175 const escapedCommand = getEscapedCommand(file, args);176 logCommand(escapedCommand, parsed.options);177177 const input = handleInputSync(parsed.options);178 validateInputOptions(parsed.options);179 const inputOption = handleInputSync(parsed.options);180181 let result;182 try {181 result = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});183 result = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input: inputOption});184 } catch (error) {185 throw makeError({186 error,187 stdout: '',
124 unmodified lines
modified:package.json+1 added-1 removed
55 unmodified lines
56 "strip-final-newline": "^4.0.0"57 },58 "devDependencies": {59 "@types/node": "^20.8.9",60 "ava": "^5.3.1",60 "ava": "^6.0.1",61 "c8": "^8.0.1",62 "get-node": "^15.0.0",63 "is-running": "^2.1.0",64 "p-event": "^6.0.0",
26 unmodified lines