From 52086b38acd5c23d8771dcec9a57f29eba55f1c2 Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 14:54:44 +0200 Subject: [PATCH 1/7] Complete types in Node API: child_process.execSync --- lib/node.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node.js b/lib/node.js index bee0179a7be..d0ecd0f7fb8 100644 --- a/lib/node.js +++ b/lib/node.js @@ -144,6 +144,7 @@ type child_process$execSyncOpts = { input?: string | Buffer; stdio?: Array; env?: Object; + shell?: string, uid?: number; gid?: number; timeout?: number; From e108266aa053ea9547ea09d0ab92d61758a1ee2a Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:03:23 +0200 Subject: [PATCH 2/7] Complete types for node v6: child_process.spawn --- lib/node.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node.js b/lib/node.js index d0ecd0f7fb8..48144bf9fc0 100644 --- a/lib/node.js +++ b/lib/node.js @@ -182,10 +182,12 @@ type child_process$Handle = any; // TODO type child_process$spawnOpts = { cwd?: string; env?: Object; + argv0?: string; stdio?: string | Array; detached?: boolean; uid?: number; gid?: number; + shell?: boolean | string; }; type child_process$spawnRet = { From 1bd6b5cdc8c65f21c113d7cf59afd7b2de6682cc Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:14:15 +0200 Subject: [PATCH 3/7] Add types for node's child_process.execFileSync --- lib/node.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/node.js b/lib/node.js index 48144bf9fc0..73e3c0bd65f 100644 --- a/lib/node.js +++ b/lib/node.js @@ -166,6 +166,19 @@ type child_process$execFileOpts = { type child_process$execFileCallback = (error: ?child_process$Error, stdout: Buffer, stderr: Buffer) => void; +type child_process$execFileSyncOpts = { + cwd?: string; + input?: string | Buffer; + stdio?: Array; + env?: Object; + uid?: number; + gid?: number; + timeout?: number; + killSignal?: string; + maxBuffer?: number; + encoding?: string; +}; + type child_process$forkOpts = { cwd?: string; env?: Object; @@ -241,8 +254,8 @@ declare module "child_process" { declare function execFileSync( command: string, - argsOrOptions?: Array | child_process$execFileOpts, - options?: child_process$execFileOpts + argsOrOptions?: Array | child_process$execFileSyncOpts, + options?: child_process$execFileSyncOpts ): Buffer | string; declare function fork( From d90118630d0c57bde59eb6de516c0ef479db2d64 Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:20:42 +0200 Subject: [PATCH 4/7] Update types in Node API: child_process.spawnSync --- lib/node.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/node.js b/lib/node.js index 73e3c0bd65f..8725a10e44b 100644 --- a/lib/node.js +++ b/lib/node.js @@ -213,6 +213,22 @@ type child_process$spawnRet = { error: Error; }; +type child_process$spawnSyncOpts = { + cwd?: string; + input?: string | Buffer; + stdio?: Array; + env?: Object; + uid?: number; + gid?: number; + timeout?: number; + killSignal?: string; + maxBuffer?: number; + encoding?: string; + shell?: boolean | string; +}; + +type child_process$spawnSyncRet = child_process$spawnRet; + declare class child_process$ChildProcess extends events$EventEmitter { stdin: stream$Writable; stdout: stream$Readable; @@ -272,9 +288,9 @@ declare module "child_process" { declare function spawnSync( command: string, - argsOrOptions?: Array | child_process$spawnOpts, - options?: child_process$spawnOpts - ): child_process$spawnRet; + argsOrOptions?: Array | child_process$spawnSyncOpts, + options?: child_process$spawnSyncOpts + ): child_process$spawnSyncRet; } type cluster$Worker = { From d02c973b6f4f6bc30d160ea6e34f9a162d3fcf35 Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:31:34 +0200 Subject: [PATCH 5/7] Update types in Node API: ChildProcess class --- lib/node.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/node.js b/lib/node.js index 8725a10e44b..7925379c487 100644 --- a/lib/node.js +++ b/lib/node.js @@ -230,15 +230,20 @@ type child_process$spawnSyncOpts = { type child_process$spawnSyncRet = child_process$spawnRet; declare class child_process$ChildProcess extends events$EventEmitter { - stdin: stream$Writable; - stdout: stream$Readable; - stderr: stream$Readable; - pid: number; connected: boolean; - disconnect(): void; kill(signal?: string): void; - send(message: Object, sendHandle?: child_process$Handle): boolean; + pid: number; + send( + message: Object, + sendHandleOrCallback?: child_process$Handle, + optionsOrCallback?: Object | () => void, + callback?: () => void + ): boolean; + stderr: stream$Readable; + stdin: stream$Writable; + stdio: Array; + stdout: stream$Readable; } declare module "child_process" { From ad836b0507231c0ec3fc6bd04cc916c25e0f1b23 Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:38:39 +0200 Subject: [PATCH 6/7] Follow props go first --- lib/node.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/node.js b/lib/node.js index 7925379c487..5069857fc82 100644 --- a/lib/node.js +++ b/lib/node.js @@ -231,19 +231,20 @@ type child_process$spawnSyncRet = child_process$spawnRet; declare class child_process$ChildProcess extends events$EventEmitter { connected: boolean; + stderr: stream$Readable; + stdin: stream$Writable; + stdio: Array; + stdout: stream$Readable; + pid: number; + disconnect(): void; kill(signal?: string): void; - pid: number; send( message: Object, sendHandleOrCallback?: child_process$Handle, optionsOrCallback?: Object | () => void, callback?: () => void ): boolean; - stderr: stream$Readable; - stdin: stream$Writable; - stdio: Array; - stdout: stream$Readable; } declare module "child_process" { From a8e6f026af0525822433d24890c24eff4131ba53 Mon Sep 17 00:00:00 2001 From: Glenn Reyes Date: Mon, 3 Oct 2016 15:43:44 +0200 Subject: [PATCH 7/7] Fix wrong type for id in cluster.Worker --- lib/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node.js b/lib/node.js index 5069857fc82..2500b8b3275 100644 --- a/lib/node.js +++ b/lib/node.js @@ -300,7 +300,7 @@ declare module "child_process" { } type cluster$Worker = { - id: string; + id: number; process: child_process$ChildProcess; suicide: boolean;