summaryrefslogtreecommitdiff
path: root/src/spawn_sync.cc
Commit message (Collapse)AuthorAgeFilesLines
* child_process: move process.binding('spawn_sync') to internalBindingAnto Aravinth2018-09-151-1/+1
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/22260 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* src: remove calls to deprecated V8 functions (Int32Value)Michaël Zasso2018-09-051-3/+4
| | | | | | | | | | | Remove all calls to deprecated V8 functions (here: Value::Int32Value) inside the code. PR-URL: https://github.com/nodejs/node/pull/22662 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
* src: rework (mostly internal) functions to use MaybesUjjwal Sharma2018-09-021-54/+71
| | | | | | | | | | | Rework all affected functions to use Maybes, thus improving error handling substantially in internal functions, API functions as well as utilities. Co-authored-by: Michaël Zasso <targos@protonmail.com> PR-URL: https://github.com/nodejs/node/pull/21935 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: remove calls to deprecated v8 functions (ToString)Ujjwal Sharma2018-09-021-2/+8
| | | | | | | | | Remove all calls to deprecated v8 functions (here: Value::ToString) inside the code (src directory only). PR-URL: https://github.com/nodejs/node/pull/21935 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: remove calls to deprecated v8 functions (NewFromUtf8)Ujjwal Sharma2018-07-291-1/+4
| | | | | | | | | | | Remove all calls to deprecated v8 functions (here: String::NewFromUtf8) inside the code (src directory only). PR-URL: https://github.com/nodejs/node/pull/21926 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* worker,src: display remaining handles if `uv_loop_close` failsAnna Henningsen2018-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | Right now, we crash the process if there are handles remaining on the event loop when we exit (except for the main thread). This does not provide a lot of information about causes, though; in particular, we don’t show which handles are pending and who own them. This patch adds debug output to these cases to help with the situation. PR-URL: https://github.com/nodejs/node/pull/21238 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: add CHECK_NULL/CHECK_NOT_NULL macrosTobias Nießen2018-05-261-3/+3
| | | | | | | | | | | | | This change introduces CHECK_NULL and CHECK_NOT_NULL macros similar to their definition in v8 and replaces instances of CHECK/CHECK_EQ/CHECK_NE with these where it seems appropriate. PR-URL: https://github.com/nodejs/node/pull/20914 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* src: remove unused stdlib.h includeDaniel Bevenius2018-03-201-1/+0
| | | | | | | | | | | Commit 870229e66529309dfea932c52d718ddc2d734966 ("src: Add ABORT macro") replaced the abort call with the abort macro in util-inl.h. This commit removes the include as it is not needed anymore. PR-URL: https://github.com/nodejs/node/pull/19427 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: make ownership of stdio_pipes explicitFranziska Hinkelmann2017-11-161-24/+16
| | | | | | | | Use smart pointers instead of raw pointers for StdioPipes. Also, use a smart pointer for the array holding them. PR-URL: https://github.com/nodejs/node/pull/17030 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: explicitly register built-in modulesYihong Wang2017-11-131-1/+1
| | | | | | | | | | | | | | | | | Previously, built-in modules are registered before main() via __attribute__((constructor)) mechanism in GCC and similiar mechanism in MSVC. This causes some issues when node is built as static library. Calling module registration function for built-in modules in node::Init() helps to avoid the issues. Signed-off-by: Yihong Wang <yh.wang@ibm.com> PR-URL: https://github.com/nodejs/node/pull/16565 Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: combine loops in CopyJsStringArray()cjihrig2017-10-181-11/+8
| | | | | | | | | | | In spawn_sync.cc, two consecutive loops are used to convert data to strings, and compute the size of the data. This commit merges the two independent loops into one. Refs: https://github.com/nodejs/node/pull/15380 PR-URL: https://github.com/nodejs/node/pull/16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* src: increase usage of context in spawn_sync.cccjihrig2017-10-181-47/+84
| | | | | | | Refs: https://github.com/nodejs/node/pull/15380 PR-URL: https://github.com/nodejs/node/pull/16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* child_process: add windowsHide optioncjihrig2017-10-161-0/+5
| | | | | | | | | | | This commit exposes the UV_PROCESS_WINDOWS_HIDE flag in Node as a windowsHide option to the child_process methods. The option is only applicable to Windows, and is ignored elsewhere. Fixes: https://github.com/nodejs/node/issues/15217 PR-URL: https://github.com/nodejs/node/pull/15380 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* meta: restore original copyright headerJames M Snell2017-03-101-0/+21
| | | | | | | | | | | | | | | A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
* child_process: exit spawnSync with null on signalcjihrig2017-02-141-4/+9
| | | | | | | | | | | | | This commit sets the spawnSync() exit code to null when the child is killed via signal. This brings the behavior more in sync with spawn(). Fixes: https://github.com/nodejs/node/issues/11284 PR-URL: https://github.com/nodejs/node/pull/11288 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
* child_process: allow Infinity as maxBuffer valuecjihrig2017-01-171-2/+2
| | | | | | Fixes: https://github.com/nodejs/node/pull/10767 PR-URL: https://github.com/nodejs/node/pull/10769 Reviewed-By: James M Snell <jasnell@gmail.com>
* src: remove redundant spawn/spawnSync type checkscjihrig2016-12-251-14/+5
| | | | | | | | | | | This commit removes C++ checks from spawn() and spawnSync() that are duplicates of the JavaScript type checking. Fixes: https://github.com/nodejs/node/issues/8096 Fixes: https://github.com/nodejs/node/issues/8539 Refs: https://github.com/nodejs/node/issues/9722 PR-URL: https://github.com/nodejs/node/pull/8312 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: add handle check to spawn_synccjihrig2016-12-251-1/+6
| | | | | | | | | | | | | | This commit verifies that the child process handle is of the correct type before trying to close it in CloseHandlesAndDeleteLoop(). This catches the case where input validation failed, and the child process was never actually spawned. Fixes: https://github.com/nodejs/node/issues/8096 Fixes: https://github.com/nodejs/node/issues/8539 Refs: https://github.com/nodejs/node/issues/9722 PR-URL: https://github.com/nodejs/node/pull/8312 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* src: fix bad logic in uid/gid checksBen Noordhuis2016-06-291-26/+7
| | | | | | | | | | | | | | | Pointed out by Coverity. Introduced in commits 3546383c ("process_wrap: avoid leaking memory when throwing due to invalid arguments") and fa4eb47c ("bindings: add spawn_sync bindings"). The return statements inside the if blocks were dead code because their guard conditions always evaluated to false. Remove them. PR-URL: https://github.com/nodejs/node/pull/7374 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* src: fix readability/nolint cpplint warningsBen Noordhuis2016-06-281-3/+2
| | | | | PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* src: Add ABORT macroEvan Lucas2015-09-171-2/+2
| | | | | | | | | | | | Windows 8+ compiled in Release mode exits with code 0xC0000409 when abort() is called. This prevents us from being able to reliably verify an abort exit code (3) on windows. PR-URL: https://github.com/nodejs/node/pull/2776 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* src: replace usage of v8::Handle with v8::LocalMichaël Zasso2015-09-061-4/+3
| | | | | | | v8::Handle is deprecated: https://codereview.chromium.org/1224623004 PR-URL: https://github.com/nodejs/io.js/pull/2202 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* buffer: switch API to return MaybeLocal<T>Trevor Norris2015-08-041-1/+1
| | | | | | | | | Instead of aborting in case of internal failure, return an empty Local<Object>. Using the MaybeLocal<T> API, users must check their return values. PR-URL: https://github.com/nodejs/io.js/pull/1825 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* core: implement runtime flag to trace sync ioTrevor Norris2015-05-181-1/+3
| | | | | | | | | | | | | | | | | | | | Use the --trace-sync-io flag to print a stack trace whenever a sync method is used after the first tick, excluding during the process exit event. (e.g. fs.readFileSync()) It does not track if the warning has occurred at a specific location in the past and so will print the warning every time. Reason for not printing during the first tick of the appication is so all necessary resources can be required. Also by excluding synchronous calls during exit is necessary in case any data needs to be logged out by the application before it shuts down. Fixes: https://github.com/nodejs/io.js/issues/1674 PR-URL: https://github.com/nodejs/io.js/pull/1707 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
* src: fix minor inefficiency in Buffer::New() callBen Noordhuis2015-05-051-3/+3
| | | | | | | | | Commit ccb199a ("src: fix deprecation warnings") passes env()->isolate() to the Buffer::New() call. It's somewhat inefficient because the callee looks up the environment from the isolate. Just pass the env directly. PR-URL: https://github.com/iojs/io.js/pull/1577 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* src: fix deprecation warningsBen Noordhuis2015-04-301-3/+3
| | | | | | | | | The previous commit enables deprecation warnings, this commit fixes the handful of offending sites where the isolate was not explicitly being passed around. PR-URL: https://github.com/iojs/io.js/pull/1565 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* src: ignore ENOTCONN on shutdown race with childBen Noordhuis2015-03-281-0/+8
| | | | | | | | | | | | | | | | | On AIX, OS X and the BSDs, calling shutdown() on one end of a pipe when the other end has closed the connection fails with ENOTCONN. The sequential/test-child-process-execsync test failed sporadically because of a race between the parent and the child where one closed its end of the pipe before the other got around to calling shutdown() on its end of the pipe. Libuv is not the right place to handle that because it can't tell if the ENOTCONN error is genuine but io.js can. Refs: https://github.com/libuv/libuv/pull/268 PR-URL: https://github.com/iojs/io.js/pull/1214 Reviewed-By: Bert Belder <bertbelder@gmail.com>
* Remove excessive copyright/license boilerplateisaacs2015-01-121-21/+0
| | | | | | | The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
* src: pass Isolate to additional locationsTrevor Norris2015-01-071-2/+2
| | | | | | | Due to a recent V8 upgrade, more methods require Isolate as an argument. PR-URL: https://github.com/iojs/io.js/pull/244 Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
* lib,src: fix spawnSync ignoring its 'env' optionJuanjo2014-12-091-2/+2
| | | | | PR-URL: https://github.com/joyent/node/pull/8546 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* src: replace NULL with nullptrBen Noordhuis2014-10-231-35/+35
| | | | | | | | | | Now that we are building with C++11 features enabled, replace use of NULL with nullptr. The benefit of using nullptr is that it can never be confused for an integral type because it does not support implicit conversions to integral types except boolean - unlike NULL, which is defined as a literal `0`.
* src: attach env directly to api functionsBen Noordhuis2014-10-131-3/+3
| | | | | | | | | | | | | | | | | Attach the per-context execution environment directly to API functions. Rationale: * Gets node one step closer to multi-isolate readiness. * Avoids multi-context confusion, e.g. when the caller and callee live in different contexts. * Avoids expensive calls to pthread_getspecific() on platforms where V8 does not know how to use the thread-local storage directly. (Linux, the BSDs.) PR-URL: https://github.com/node-forward/node/pull/18 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* src: replace assert() with CHECK()Ben Noordhuis2014-10-121-32/+32
| | | | | | | | | | | Mechanically replace assert() statements with UNREACHABLE(), CHECK(), or CHECK_{EQ,NE,LT,GT,LE,GE}() statements. The exceptions are src/node.h and src/node_object_wrap.h because they are public headers. PR-URL: https://github.com/node-forward/node/pull/16 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* src: remove unnecessary HandleScopesBen Noordhuis2014-10-121-1/+0
| | | | | | | | API callback functions don't need to create a v8::HandleScope instance because V8 already creates one in the JS->C++ adapter frame. PR-URL: https://github.com/node-forward/node/pull/16 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* child_process: copy spawnSync() cwd option to proper buffercjihrig2014-07-121-1/+1
| | | | | | | | | The spawnSync() cwd option was being copied to the incorrect location. This commit copies to the correct location. Closes #7824 Signed-off-by: Fedor Indutny <fedor@indutny.com>
* child_process: fix assertion error in spawnSyncShigeki Ohtsu2014-04-301-0/+5
| | | | | | | When ExitCallback was not called with an error such as ENOENT in uv_spawn, the process handle still remains refed and needs to be closed. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* src: update uv callbacks after API changesSaúl Ibarra Corretgé2014-04-071-4/+3
| | | | | async, timer, prepare, idle and check handles no longer get a status parameter since they can never fail.
* src: update to v8 3.24 APIsFedor Indutny2014-03-131-12/+15
|
* src: use new loop APISaúl Ibarra Corretgé2014-02-281-2/+6
| | | | uv_loop_new and uv_loop_delete are considered deprecated now.
* src: spawn_sync should close handles upon exitSaúl Ibarra Corretgé2014-02-261-0/+1
| | | | | When the exit callback is fired for the child process we should close the handle associated with it.
* src: remove `node_isolate` from sourceFedor Indutny2014-02-221-4/+7
| | | | fix #6899
* bindings: add spawn_sync bindingsBert Belder2014-02-101-0/+1042
This implements a nested event loop that makes it possible to control a child process, while blocking the main loop until the process exits.