Skip to content

Commit bca31c0

Browse files
committed
child_process: improve argument validation
nodejs/node#41305
1 parent 0646bc4 commit bca31c0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ Subject: refactor: alter child_process.fork to use execute script with
77
When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary.
88

99
diff --git a/lib/child_process.js b/lib/child_process.js
10-
index 77b9ff35ff6ea780121aa1f4bb71850b9245965a..2a91c4820bebf55068c4d54a2e1133176de77a6d 100644
10+
index 6ce21363e1ee6acdd2e48763d0637ef1983e5264..f448bde2a570480a4390daf5392dc9d9b0f52df3 100644
1111
--- a/lib/child_process.js
1212
+++ b/lib/child_process.js
13-
@@ -161,6 +161,15 @@ function fork(modulePath, args = [], options) {
14-
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
13+
@@ -136,6 +136,16 @@ function fork(modulePath, args = [], options) {
14+
validateObject(options, 'options');
1515
}
16-
16+
options = { ...options, shell: false };
17+
+
1718
+ // When forking a child script, we setup a special environment to make
1819
+ // the electron binary run like upstream Node.js
1920
+ options.env = Object.create(options.env || process.env)
@@ -24,5 +25,6 @@ index 77b9ff35ff6ea780121aa1f4bb71850b9245965a..2a91c4820bebf55068c4d54a2e113317
2425
+ }
2526
+
2627
options.execPath = options.execPath || process.execPath;
27-
options.shell = false;
28+
29+
// Prepare arguments for fork:
2830

0 commit comments

Comments
 (0)