-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary process.args/env coping when spawning a child? #45868
Comments
Libuv's The code has changed over the years but the comment persisted. Maybe it should just be removed. Something I noticed in the surrounding code: CHECK_GT(argc + 1, 0); // Check for overflow. I think that's trying to check that |
@bnoordhuis Thanks for the information. The code makes sense to me now :) |
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #45868 PR-URL: #45882 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: James M Snell <[email protected]>
The following TODO arouses my interest. Why we need to deep copy args and env to heap? The parent can not access or even modify the copy of them in the child once
uv_spawn
succeed, in case it failed, libuv does not(and has no reason) to touch them.Code to prepare uv_process_options_t before call uv_spawn() in the implementation of
child_process.spawn
:node/src/process_wrap.cc
Lines 178 to 204 in b3f5a41
Code to prepare uv_process_options_t before call uv_spawn() in the implementation of
child_process.spawnSync
:node/src/spawn_sync.cc
Lines 755 to 765 in b3f5a41
The text was updated successfully, but these errors were encountered: