0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
Commit Graph

223 Commits

Author SHA1 Message Date
Rich Trott
50f45fffc1 lib: modify destructuring for indentation
ESLint 4.3.0 flags an extra indentation issue that affects two of our
destructuring assignments in `lib`. This is a whitespace-only update to
comply prior to updating.

PR-URL: https://github.com/nodejs/node/pull/14417
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-07-25 12:21:26 -07:00
Rich Trott
6d090e1094 child_process: refactor normalizeSpawnArguments()
Code is not in hot path. Refactor ternary to be more readable if/else
block that mirrors analogous code elsewhere in the function. Change
string concatenation to template literal.

PR-URL: https://github.com/nodejs/node/pull/14149
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-07-12 12:09:43 -07:00
Rich Trott
0d22858d67 lib: remove excess indentation
In anticipation of stricter linting for indentation, remove instances of
extra indentation that will be flagged by the new rules.

PR-URL: https://github.com/nodejs/node/pull/14090
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-07-07 13:18:19 -07:00
Rich Trott
095c0de94d benchmark,lib,test: use braces for multiline block
For if/else and loops where the bodies span more than one line, use
curly braces.

PR-URL: https://github.com/nodejs/node/pull/13828
Ref: https://github.com/nodejs/node/pull/13623#discussion_r123048602
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-23 14:43:20 -07:00
Brian White
448c4c62d2
child_process: do not extend result for *Sync()
PR-URL: https://github.com/nodejs/node/pull/13601
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-06-13 19:19:16 -04:00
Gil Tayar
8d7f07f379
child_process: promisify includes stdio in error
This converts the initial implementation of a promised exec that used
the customPromisifyArgs support in util.promisify with a custom
implementation. This is because exec and execFile, when there is an
error, still supply the stdout and stderr of the process, and yet
the promisified version with customPromisifyArgs does
not supply this ability.

I created a custom implementation and attached it to exec and execFile
using the util.promisify.custom key.

Fixes: https://github.com/nodejs/node/issues/13364
PR-URL: https://github.com/nodejs/node/pull/13388
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-06-09 21:46:09 +02:00
Anna Henningsen
fe5ca3ff27
child_process: support promisified exec(File)
Author: Benjamin Gruenbaum <inglor@gmail.com>
Author: Anna Henningsen <anna@addaleax.net>

PR-URL: https://github.com/nodejs/node/pull/12442
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: William Kapke <william.kapke@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2017-05-09 15:01:45 +02:00
Sakthipriyan Vairamani (thefourtheye)
d75fdd96aa
child_process: improve killSignal validations
As it is, the `killSignal` is just retrieved from an object and used.
If the signal passed is actually one of the inherited properties of
that object, Node.js will die. For example,

    ➜  node -e "child_process.spawnSync('ls', {killSignal: 'toString'})"
    Assertion failed: (0), function uv_close, file ....core.c, line 166.
    [1]    58938 abort      node -e "child_process.spawnSync(...)"

1. This patch makes sure that the signal is actually a own property of
   the constants object.

2. Extends the killSignal validation to all the other functions.

PR-URL: https://github.com/nodejs/node/pull/10423

Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-04 13:02:51 +05:30
Jackson Tian
dc9717c805 lib: clarify the usage of 'else'
The keyword 'else' is unnecessary after 'throw' statements.

PR-URL: https://github.com/nodejs/node/pull/11148
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-26 12:14:11 +02:00
James M Snell
98e54b0bd4 meta: restore original copyright header
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.
2017-03-10 11:23:48 -08:00
Vse Mozhet Byt
dd81d539e2 child_process: fix deoptimizing use of arguments
Removed or fixed use of arguments in execFile(),
normalizeExecArgs(), and normalizeSpawnArguments().

Refs: https://github.com/nodejs/node/issues/10323
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=6010
PR-URL: https://github.com/nodejs/node/pull/11535
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-03-01 10:24:03 -05:00
Sakthipriyan Vairamani (thefourtheye)
dce37dc35b
lib: remove unnecessary assignments with _extend
The first parameter to `util._extend` is the target object. Assigning
the target object to the result of `util._extend` is not necessary.

PR-URL: https://github.com/nodejs/node/pull/11364

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-22 10:35:25 +05:30
Michaël Zasso
193468667b tools: enable one-var-declaration-per-line ESLint rule
This rule enforces new lines around variable declarations. It is
configured to spot only variables that are initialized.

PR-URL: https://github.com/nodejs/node/pull/11462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-02-21 12:53:19 +01:00
cjihrig
a1c652ae60 child_process: remove empty if condition
This commit replaces an empty if-else-if with a single if
condition.

PR-URL: https://github.com/nodejs/node/pull/11427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-02-18 15:55:33 +01:00
Sam Roberts
4cafa60c99 child_process: align fork/spawn stdio error msg
fork()'s support for .stdio strings in 3268863eb used a different
TypeError string from spawn, unnecessarily.

PR-URL: https://github.com/nodejs/node/pull/11044
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-11 14:06:26 -08:00
James M Snell
5de3cf099c lib: add static identifier codes for all deprecations
Assigns a static identifier code to all runtime and documentation
only deprecations. The identifier code is included in the emitted
DeprecationWarning.

Also adds a deprecations.md to the API docs to provide a central
location where deprecation codes can be referenced and explained.

PR-URL: https://github.com/nodejs/node/pull/10116
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-01-30 11:11:57 -08:00
Javis Sullivan
3268863ebc child_process: add string shortcut for fork stdio
Add string shortcut option for stdio parameter.

Fixes: https://github.com/nodejs/node/issues/10793
PR-URL: https://github.com/nodejs/node/pull/10866
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-01-27 12:06:48 -08:00
cjihrig
8f3ff98f0e child_process: allow Infinity as maxBuffer value
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>
2017-01-17 10:47:28 -05:00
Anna Henningsen
627ecee9ed child_process: support Uint8Array input to methods
Support `Uint8Array` input to all the synchronous methods.

PR-URL: https://github.com/nodejs/node/pull/10653
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-01-10 11:35:45 -08:00
cjihrig
fc7b0dda85 child_process: improve input validation
This commit applies stricter input validation in
normalizeSpawnArguments(), which is run by all of the
child_process methods. Additional checks are added for spawnSync()
specific inputs.

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>
2016-12-25 12:48:46 -05:00
brad-decker
bbed075325 child_process: name anonymous functions
Refs: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/9880
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-12-05 07:35:52 -08:00
cjihrig
49d1c366d8 child_process: remove extra newline in errors
checkExecSyncError() creates error objects for execSync() and
execFileSync(). If the child process created stderr output, then
it is attached to the end of the error message. However, stderr
can be an empty Buffer object, which always passes the truthy
check, leading to an extra newline in the error message. This
commit adds a length check, which will work with both strings and
Buffers.

PR-URL: https://github.com/nodejs/node/pull/9343
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-11-02 19:25:32 -04:00
cjihrig
ec7c27f4cb child_process: remove unreachable code
_convertCustomFds() is only called from normalizeSpawnArguments(),
which always provides an options object. Therefore, there is no
need to check for options in _convertCustomFds().

PR-URL: https://github.com/nodejs/node/pull/9307
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-29 13:29:58 -04:00
cjihrig
dd13d71eb3 child_process: remove unreachable execSync() code
Code coverage showed that the execSync() variable inheritStderr
was never set to the default value of true. This is because
the default case is hit whenever normalizeExecArgs() returns an
object without an 'options' property. However, this can never
be the case because normalizeExecArgs() unconditionally creates
the options object. This commit removes the unreachable code.

PR-URL: https://github.com/nodejs/node/pull/9209
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-10-24 22:46:56 -04:00
Tanuja-Sawant
835fbeee00 child_process: update outdated comment
PR-URL: https://github.com/nodejs/node/pull/8988/
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-14 09:00:47 -07:00
Bartosz Sosnowski
b90f3da9de
child_process, win: fix shell spawn with AutoRun
Under Windows system can be configured to execute a specific command
each time a shell is spawned. Under some conditions this breaks the
way node handles shell scripts under windows.
This commit adds /d switch to spawn and spawnSync which disables this
AutoRun functionality.

Fixes: https://github.com/nodejs/node-v0.x-archive/issues/25458
PR-URL: https://github.com/nodejs/node/pull/8063
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-09-09 20:51:43 +02:00
Pat Pannuto
99f45b2476
child_process: control argv0 for spawned processes
In some cases it useful to control the value of `argv[0]`, c.f.
 - https://github.com/andrewffff/child_process_with_argv0
 - https://github.com/andrep/argv0

This patch adds explicit support for setting the value of `argv[0]`
when spawning a process.

PR-URL: https://github.com/nodejs/node/pull/7696
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-08 16:35:43 +02:00
cjihrig
ff3ce11894 child_process: support stdio option in fork()
This commit allows child_process.fork() to pass stdio options
to spawn(). This allows fork() to more easily take advantage of
additional stdio channels.

Refs: https://github.com/nodejs/node-v0.x-archive/issues/5727
PR-URL: https://github.com/nodejs/node/pull/7811
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-07-22 11:57:01 -04:00
Robert Chiras
765de1ae11 child_process: Check stderr before accessing it
If something bad happens in spawnSync, stderr might be null. Therefore,
we have to check it before using it, so we won't mask the actual
exception.

PR-URL: https://github.com/nodejs/node/pull/6877
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-07-19 13:27:30 +02:00
Chuck Langford
99cfd53097 test: test execFile/fork arg validation
Fixes: https://github.com/nodejs/node/issues/2681
Refs: https://github.com/nodejs/node/pull/4508
PR-URL: https://github.com/nodejs/node/pull/7399
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-30 16:14:55 -07:00
Rich Trott
0548e5d12a child_process: add fork/execFile arg validation
Validate fork/execFile arguments.

Fixes: https://github.com/nodejs/node/issues/2681
Refs: https://github.com/nodejs/node/pull/4508
PR-URL: https://github.com/nodejs/node/pull/7399
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-06-30 16:14:27 -07:00
Rich Trott
0268fd0a9f child_process: preserve argument type
A previous fix for a `maxBuffer` bug resulted in a change to the
argument type for the `data` event on `child.stdin` and `child.stdout`
when using `child_process.exec()`.

This fixes the `maxBuffer` bug in a way that does not have that side
effect.

PR-URL: https://github.com/nodejs/node/pull/7391
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Fixes: https://github.com/nodejs/node/issues/7342
Refs: https://github.com/nodejs/node/issues/1901
2016-06-30 16:04:54 -07:00
Rich Trott
8da541bf5f Revert "child_process: measure buffer length in bytes"
This reverts commit c9a5990a76.

PR-URL: https://github.com/nodejs/node/pull/7391
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
2016-06-30 16:03:53 -07:00
Rich Trott
c9a5990a76 child_process: measure buffer length in bytes
This change fixes a known issue where `maxBuffer` limits by characters
rather than bytes. Benchmark added to confirm no performance regression
occurs with this change.

PR-URL: https://github.com/nodejs/node/pull/6764
Fixes: https://github.com/nodejs/node/issues/1901
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-05-25 10:57:59 -07:00
cjihrig
dc76afffb6 child_process: allow buffer encoding in spawnSync
When the 'buffer' encoding is passed to spawnSync(), an exception
is thrown in Buffer's toString() method because 'buffer' is not
a valid encoding there. This commit special cases the 'buffer'
encoding.

Fixes: https://github.com/nodejs/node/issues/6930
PR-URL: https://github.com/nodejs/node/pull/6939
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-05-24 09:59:11 -04:00
James M Snell
dcccbfdc79 src: refactor require('constants')
The require('constants') module is currently undocumented and mashes
together unrelated constants. This refactors the require('constants')
in favor of distinct os.constants, fs.constants, and crypto.constants
that are specific to the modules for which they are relevant. The
next step is to document those within the specific modules.

PR-URL: https://github.com/nodejs/node/pull/6534
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com>
2016-05-17 11:05:18 -07:00
Ben Noordhuis
f4f6c6e815 child_process: use /system/bin/sh on android
`/bin/sh` does not exist on Android but `/system/bin/sh` does.

PR-URL: https://github.com/nodejs/node/pull/6745
Refs: https://github.com/nodejs/node/pull/6733
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-05-14 12:04:36 +02:00
Rich Trott
31600735f4 lib,test,tools: alignment on variable assignments
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.

PR-URL: https://github.com/nodejs/node/pull/6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-18 17:19:11 -07:00
James M Snell
85ab4a5f12 buffer: add .from(), .alloc() and .allocUnsafe()
Several changes:

* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs

PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-16 08:34:02 -07:00
cjihrig
c3bb4b1aa5 child_process: add shell option to spawn()
This commit adds a shell option, to spawn() and spawnSync(). This
option allows child processes to be spawned with or without a
shell. The option also allows a custom shell to be defined, for
compatibility with exec()'s shell option.

Fixes: https://github.com/nodejs/node/issues/1009
PR-URL: https://github.com/nodejs/node/pull/4598
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-26 19:40:43 -05:00
cjihrig
7b355c5bb3 child_process: add safety checks on stdio access
When a child process is spawned, there is no guarantee that stdout
and stderr will be created successfully. This commit adds checks
before attempting to access the streams.

PR-URL: https://github.com/nodejs/node/pull/3799
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-12 17:52:09 -08:00
micnic
20285ad177 lib: Consistent error messages in all modules
This commit fixes some error messages that are not consistent with
some general rules which most of the error messages follow.

PR-URL: https://github.com/nodejs/node/pull/3374
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-11-09 20:08:36 +01:00
Ben Noordhuis
57bce60da3 child_process: don't fork bomb ourselves from -e
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: https://github.com/nodejs/node/issues/3574
PR-URL: https://github.com/nodejs/node/pull/3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-10-29 01:31:54 +01:00
James M Snell
32037b78a2 child_process: check execFile and fork args
Port of joyent/node commits:

 * e17c5a72b2
 * 70dafa7b62

Pull over test-child-process-spawn-typeerror.js from v0.12, replacing
the existing test in master. The new test includes a broader set of
tests on the various arg choices and throws.

Reviewed-By: trevnorris - Trevor Norris <trevnorris@nodejs.org>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: thefourtheye - Sakthipriyan Vairamani
PR-URL: https://github.com/nodejs/node/pull/2667
Fixes: https://github.com/nodejs/node/issues/2515
2015-09-06 21:38:00 +10:00
Ben Noordhuis
607aa3ac82 child_process: add callback parameter to .send()
Add an optional callback parameter to `ChildProcess.prototype.send()`
that is invoked when the message has been sent.

Juggle the control channel's reference count so that in-flight messages
keep the event loop (and therefore the process) alive until they have
been sent.

`ChildProcess.prototype.send()` and `process.send()` used to operate
synchronously but became asynchronous in commit libuv/libuv@393c1c5
("unix: set non-block mode in uv_{pipe,tcp,udp}_open"), which landed
in io.js in commit 07bd05b ("deps: update libuv to 1.2.1").

Fixes: https://github.com/nodejs/node/issues/760
PR-URL: https://github.com/nodejs/node/pull/2620
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
2015-09-06 21:37:58 +10:00
Roman Reiss
5acad6b163 child_process: fix arguments comments
Fixes the arguments comments for execFileSync and other related minor
inconsistencies in commented arguments in the same file.

PR-URL: https://github.com/nodejs/io.js/pull/2161
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-07-12 01:16:31 +02:00
Sakthipriyan Vairamani
9cd44bb2b6 util: prepend '(node) ' to deprecation messages
Changes included in this commit are

   1. Making the deprecation messages consistent. The messages will be in
      the following format

           x is deprecated. Use y instead.

      If there is no alternative for `x`, then the ` Use y instead.` part
      will not be there in the message.

   2. All the internal deprecation messages are printed with the prefix
      `(node) `, except when the `--trace-deprecation` flag is set.

Fixes: https://github.com/nodejs/io.js/issues/1883
PR-URL: https://github.com/nodejs/io.js/pull/1892
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-03 16:32:29 +02:00
Roman Reiss
b5b8ff117c lib: don't use global Buffer
Port of https://github.com/joyent/node/pull/8603

The race condition present in the original PR didn't occur, so no
workaround was needed.

PR-URL: https://github.com/nodejs/io.js/pull/1794
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-11 20:24:44 +02:00
Evan Lucas
a77c330c32 child_process: expose ChildProcess constructor
Creates two new internal modules (child_process and socket_list) for
better readability.

Exposes the ChildProcess constructor from the child_process module so
one can now `require(‘child_process’).ChildProcess`

Fixes: https://github.com/nodejs/io.js/issues/1751
PR-URL: https://github.com/nodejs/io.js/pull/1760
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-28 09:38:29 -05:00
Yosuke Furukawa
19ffb5cf1c lib: fix eslint styles
PR-URL: https://github.com/iojs/io.js/pull/1539
Fixes: https://github.com/iojs/io.js/issues/1253
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-05-09 12:10:02 +09:00