Commit Graph

14 Commits

Author SHA1 Message Date
木杉
c030f88fcf
child_process: avoid repeated calls to normalizeSpawnArguments
PR-URL: https://github.com/nodejs/node/pull/43345
Fixes: https://github.com/nodejs/node/issues/43333
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
2022-07-18 10:20:57 +01:00
Wassim Chegham
eaadc4bd30 test: refactor code to use AbortSignal.abort()
PR-URL: https://github.com/nodejs/node/pull/37798
Refs: https://github.com/whatwg/dom/pull/960
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2021-03-20 19:21:13 +01:00
Carlos Fuentes
2242cbb253
child_process: allow promisified exec to be cancel
Using new AbortController, add support for promisified
exec to be cancelled.

PR-URL: https://github.com/nodejs/node/pull/34249
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-22 20:03:09 -08:00
Rich Trott
a71061a9dc child_process: treat already-aborted controller as aborting
If an AbortController passed to execfile() is already aborted, use the
same behavior as if the controller was aborted after calling execfile().
This mimics the behavior of fetch in the browser.

PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2020-12-30 07:54:03 -08:00
Rich Trott
6c0bd0b6e4 test: add test for reused AbortController with execfile()
Test that reusing an aborted AbortController with execfile() results in
immediate SIGTERM.

PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2020-12-30 07:54:01 -08:00
Benjamin Gruenbaum
f0a0e3c6b3 child_process: clean event listener correctly
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: https://github.com/nodejs/node/pull/36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-22 17:53:00 +02:00
Moshe vilner
5dd58d069f test: increase execFile abort coverage
Verify that if something different than Abortcontroller.signal is passed
to child_process.execFile(), ERR_INVALID_ARG_TYPE is thrown.

PR-URL: https://github.com/nodejs/node/pull/36429
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-10 05:36:37 -08:00
Benjamin Gruenbaum
20de5f7efc child_process: add AbortSignal support
PR-URL: https://github.com/nodejs/node/pull/36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-06 12:23:19 +02:00
Tobias Nießen
30fb4a015d test: add common.mustSucceed
PR-URL: https://github.com/nodejs/node/pull/35086
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-10-17 00:48:26 +02:00
jvelezpo
6f8de31cde
test: verify the shell option works properly on execFile
Useful for executing in a shell because it accepts arguments as
an array instead of a string as exec does.
Depending on the circumstances,
that can prove to be useful if the arguments are already prepared.

PR-URL: https://github.com/nodejs/node/pull/18384
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-04 16:38:34 +01:00
Joyee Cheung
4af1bba6d0
util: implement util.getSystemErrorName()
Reimplement uv.errname() as internal/util.getSystemErrorName() to
avoid the memory leaks caused by unknown error codes
and avoid calling into C++ for the error names. Also
expose it as a public API for external use.

PR-URL: https://github.com/nodejs/node/pull/18186
Refs: http://docs.libuv.org/en/v1.x/errors.html#c.uv_err_name
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-01-20 08:51:47 +08:00
James M Snell
7535a94c8a test: begin normalizing fixtures use
Adds a new `../common/fixtures' module to begin normalizing
`test/fixtures` use. Our test code is a bit inconsistent with
regards to use of the fixtures directory. Some code uses
`path.join()`, some code uses string concats, some other
code uses template strings, etc. In mnay cases, significant
duplication of code is seen when accessing fixture files, etc.

This updates many (but by no means all) of the tests in the
test suite to use the new consistent API. There are still
many more to update, which would make an excelent Code-n-Learn
exercise.

PR-URL: https://github.com/nodejs/node/pull/14332
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-08-07 18:00:57 -07:00
cjihrig
d2a3651872 test: complete coverage of lib/child_process.js
This commit adds a test which brings coverage of
lib/child_process.js to 100%. It adds coverage for the call to
uv.errname() in execFile()'s exithandler() function.

PR-URL: https://github.com/nodejs/node/pull/12367
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-04-18 15:15:19 -04:00
Rich Trott
1d82adc8c7 test: add test for child_process.execFile()
While `child_process.execFile()` gets called in places in the test
suite, there are no explicit test for it and there are parts of the
implementation that are not covered by tests. This adds a minimal test
that increases (but does not complete) coverage for the implementation.

PR-URL: https://github.com/nodejs/node/pull/11929
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-03-21 21:31:03 -07:00