Align Flow lib defs for Node.js child_process with v24 #55186
+155
−119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This is an AI-assisted change to align the Flow definitions for the
child_processmodule with the Node.js docs as at v24.New v18+ Features:
AbortSignal Support (v18.0.0) - Process cancellation
signal?: AbortSignaloption to all async functions (exec, execFile, fork, spawn)AbortControllerconst controller = new AbortController(); spawn('cmd', [], {signal: controller.signal}); controller.abort();Enhanced Process Properties (v20.x)
spawnargs: Array<string>- Full command-line arguments used to launch the processspawnfile: string- Executable file name of the child processsignalCode: string | null- Signal that terminated the child processChildProcess Class Updates:
Improved Property Types
stdiois now a properly typed tuple array with readonly modifierchannelchanged fromObjecttomixedfor better type safetyEnhanced Method Signatures
kill(signal?: string | number): boolean- Now returns boolean and accepts numeric signalssend()overloads properly typed withchild_process$Serializablemessagessend()acceptskeepOpenoption:Readonly<{keepOpen?: boolean}>Option Type Improvements:
Modern Readonly Syntax - All input options use
Readonly<{...}>execOpts,execFileOpts,forkOpts,spawnOpts,spawnSyncOpts, etc.Enhanced Environment Variables
env?: Objecttoenv?: {[key: string]: string | void}New Fork Options (IPC enhancements)
serialization?: 'json' | 'advanced'- IPC serialization formatkillSignalandtimeoutoptions added to forkEnhanced Spawn Options
killSignal,timeout,serializationtospawnOptsReturn Type Fixes:
status: number | null- null if process never exitedsignal: string | null- null if not terminated by signalerror: Error | void- void if no error occurredHelper Types:
child_process$Serializable- Union type for IPC messages:string | number | boolean | bigint | {...} | Array<mixed>child_process$SendHandle- Type for handle passing:net$Server | net$SocketReferences:
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D89944331