0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

3989 Commits

Author SHA1 Message Date
James M Snell
9cee8b1b62 buffer: alias toLocaleString to toString
Make Buffer.prototype.toLocaleString an alias of Buffer.prototype.toString
so that the output is actually useful.

Fixes: https://github.com/nodejs/node/issues/8147
PR-URL: https://github.com/nodejs/node/pull/8148
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-08-23 10:59:39 -07:00
James M Snell
0764bc4711 Revert "crypto: add crypto.timingSafeEqual"
This reverts commit 0fc5e0dcd9.

Additional testing indicates that there may still be timing issues
with this implementation. Revert in order to give more time for
testing before this goes out into a release...

Refs: https://github.com/nodejs/node/pull/8040
Refs: https://github.com/nodejs/node/pull/8203
PR-URL: https://github.com/nodejs/node/pull/8225
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-23 10:52:32 -07:00
cjihrig
013d76cb73 dns: remove makeAsync() function check
makeAsync() is an internal method in the dns module. All of the
functions that call makeAsync() have already validated that the
callback is a function. This commit removes a redundant typeof
function check.

PR-URL: https://github.com/nodejs/node/pull/8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
2016-08-22 11:07:05 -07:00
cjihrig
3a43568020 dns: lookupService() callback must be a function
lookupService() requires a callback function. This commit adds
a check to verify that the callback is actually a function.

PR-URL: https://github.com/nodejs/node/pull/8170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
2016-08-22 11:07:01 -07:00
Prince J Wesley
f6a74345d1
repl: Failed to save editor mode text in .save
Fixes: https://github.com/nodejs/node/issues/8142
PR-URL: https://github.com/nodejs/node/pull/8145
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-21 02:15:28 +05:30
cjihrig
ccbb3c78cd child_process: reuse existing no-op function
The internal/child_process module has an existing no-op
function. This commit utilizes that function, instead of
creating extraneous closures.

PR-URL: https://github.com/nodejs/node/pull/8164
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-08-20 16:24:44 -04:00
Santiago Gimeno
db6253f94a child_process: workaround fd passing issue on OS X
There's an issue on some `OS X` versions when passing fd's between processes.
When the handle associated to a specific file descriptor is closed by the sender
process before it's received in the destination, the handle is indeed closed
while it should remain opened. In order to fix this behaviour, don't close the
handle until the `NODE_HANDLE_ACK` is received by the sender.
Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but
creating lots of workers, so the issue reproduces on `OS X` consistently.

Fixes: https://github.com/nodejs/node/issues/7512
PR-URL: https://github.com/nodejs/node/pull/7572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-20 10:58:28 +02:00
not-an-aardvark
0fc5e0dcd9 crypto: add crypto.timingSafeEqual
PR-URL: https://github.com/nodejs/node/pull/8040
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-08-19 19:36:05 -07:00
Evan Lucas
76007079ec Revert "repl,util: insert carriage returns in output"
This reverts commit fce4b981ea.

This was a breaking change and should have been marked semver-major.
The change that was made altered the output of util.format() and
util.inspect(). With how much those are used in the wild, this type of
change deserves more justification.

Fixes: https://github.com/nodejs/node/issues/8138
PR-URL: https://github.com/nodejs/node/pull/8143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-19 11:48:52 -05:00
Rich Trott
2e59ccecde assert: remove code that is never reached
The internal function `truncate()` is only called with the first
argument being the output of `util.inspect()`. `util.inspect()` calls
its own internal `formatValue()` which is guaranteed to return a string.

Therefore, we can remove the check in `truncate()` that the first
argument is a string as well as code to handle the case where it is not
a string.

PR-URL: https://github.com/nodejs/node/pull/8132
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Alexander Makarenko <estliberitas@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-18 16:50:16 -07:00
Guy Fraser
a9387db867 debugger: use arrow function for lexical this
Refs: https://github.com/nodejs/node/issues/7414
PR-URL: https://github.com/nodejs/node/pull/7415
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-08-18 16:44:38 -07:00
Ilkka Myller
1d0385f62d url: url.format() encodes all # in search
This commit fixes an error where only the first occurrence of `#` in
`search` parameter is URL encoded, and subsequent occurrences are not.

Also added a test for the case.

Fixes: https://github.com/nodejs/node/issues/8064
PR-URL: https://github.com/nodejs/node/pull/8072
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-18 11:21:19 -07:00
Calvin Metcalf
774146dc58 stream: avoid caching prepend check
This removes the cached check for EE.prototype.prependListener
because we can't have nice things. More specifically some
libraries will bundle their own event emitter implementation.

PR-URL: https://github.com/nodejs/node/pull/8018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-08-17 18:47:41 -07:00
Sakthipriyan Vairamani
60dcd7323f tls: copy the Buffer object before using
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols`
buffer object as it is, and if it is modified outside of core, it
might have an impact. This patch makes a copy of the buffer object,
before using it.

PR-URL: https://github.com/nodejs/node/pull/8055
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-08-17 18:40:52 -07:00
Bryan English
249bb8da2f util: fix deprecated class prototype
Ensure the wrapped class prototype is exactly the unwrapped class
prototype, rather than an object whose prototype is the unwrapped
class prototype.

This ensures that instances of the unwrapped class are instances
of the wrapped class. This is useful when both a wrapped class and
a factory for the unwrapped class are both exposed.

Ref: https://github.com/nodejs/node/pull/8103
PR-URL: https://github.com/nodejs/node/pull/8105
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-17 18:27:22 -07:00
Prince J Wesley
4b883a3fb4
readline: keypress trigger for escape character
Fixes: https://github.com/nodejs/node/issues/7379
PR-URL: https://github.com/nodejs/node/pull/7382
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-08-17 23:44:39 +05:30
JungMinu
fce4b981ea repl,util: insert carriage returns in output
`\n` is not enough for Linux with some custom stream
add carriage returns to ensure that the output is displayed correctly
using `\r\n` should not be a problem, even on non-Windows platforms.

Fixes: https://github.com/nodejs/node/issues/7954
PR-URL: https://github.com/nodejs/node/pull/8028
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-13 23:03:30 +09:00
Saúl Ibarra Corretgé
6a3dbdacd6 udp: remove ancient check
PR-URL: https://github.com/nodejs/node/pull/8088
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-08-13 08:38:37 +01:00
Bartosz Sosnowski
08996fde3c fs: restore JS implementation of realpath
This reverts parts of b488b19eaf
restoring javascript implementation of realpath and realpathSync.

Fixes: https://github.com/nodejs/node/issues/7175
Fixes: https://github.com/nodejs/node/issues/6861
Fixes: https://github.com/nodejs/node/issues/7294
Fixes: https://github.com/nodejs/node/issues/7192
Fixes: https://github.com/nodejs/node/issues/7044
Fixes: https://github.com/nodejs/node/issues/6624
Fixes: https://github.com/nodejs/node/issues/6978
PR-URL: https://github.com/nodejs/node/pull/7899
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-12 13:07:55 +02:00
Aleksei Koziatinskii
f6070a1a02 deps: v8_inspector: console support
When node is running with --inspect flag, default console.log,
console.warn and other methods call inspector console methods in
addition to current behaviour (dump formatted message to stderr and
stdout). Inspector console methods forward message to DevTools and
show up in DevTools Console with DevTools formatters. Inspector
console methods not present on Node console will be added into it.

Only own methods on global.console object will be changed while in a
debugging session. User are still able to redefine it, use
console.Console or change original methods on Console.prototype.

PR-URL: https://github.com/nodejs/node/pull/7988
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
2016-08-11 17:40:42 -07:00
Jeremiah Senkpiel
ab3306ad51
tty: set the handle to blocking mode
Refs: https://github.com/nodejs/node/pull/1771
Refs: https://github.com/nodejs/node/issues/6456
Refs: https://github.com/nodejs/node/pull/6773
Refs: https://github.com/nodejs/node/issues/7743
PR-URL: https://github.com/nodejs/node/pull/6816
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-10 23:41:28 +02:00
Owen Smith
b7a8a691b4 events: unwrap #once listeners in #listeners
Fixes: https://github.com/nodejs/node/issues/6873
PR-URL: https://github.com/nodejs/node/pull/6881
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-09 14:13:09 -07:00
Jan Schär
1b99093df7 timers: remove unused repeat param in timer_wrap
The `repeat` param in `start(timeout, repeat)` was 0 in all callsites.

PR-URL: https://github.com/nodejs/node/pull/7994
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-09 12:26:10 -07:00
Roman Reiss
1a6a69a8e0
util: add inspect.defaultOptions
Adds util.inspect.defaultOptions which allows customization of the
default util.inspect options, which is useful for functions like
console.log or util.format which implicitly call into util.inspect.

PR-URL: https://github.com/nodejs/node/pull/8013
Fixes: https://github.com/nodejs/node/issues/7566
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-08-09 20:57:24 +02:00
Feross Aboukhadijeh
387ab62939 assert: fix deepEqual/deepStrictEqual on equivalent typed arrays
The typed array's underlying ArrayBuffer is used in `Buffer.from`.
Let's respect it's .byteOffset or .byteLength (i.e. position within the
parent ArrayBuffer).

Fixes: https://github.com/nodejs/node/issues/8001
PR-URL: https://github.com/nodejs/node/pull/8002
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-09 11:43:25 -07:00
hefangshi
55852e1421 module: fix node_modules search path in edge case
The `p < nmLen` condition will fail when a module's name is end with
`node_modules` like `foo_node_modules`. The old logic will miss the
`foo_node_modules/node_modules` in node_modules paths.

TL;TR, a module named like `foo_node_modules` can't require any module
 in the node_modules folder.

Fixes: https://github.com/nodejs/node/issues/6679
PR-URL: https://github.com/nodejs/node/pull/6670
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-08-09 05:46:40 -05:00
Linus Unnebäck
4a87abb8e8 fs: add bytesRead to ReadStream
Add a property named bytesRead that exposes how many bytes that have
currently been read from the file. This brings consistency with
WriteStream that has bytesWritten and net.Socket which have both
bytesRead and bytesWritten.

Fixes: https://github.com/nodejs/node/issues/#7938
PR-URL: https://github.com/nodejs/node/pull/7942
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-08 10:11:17 -07:00
Anna Henningsen
f59b8888f1 repl: disable Ctrl+C support on win32 for now
Disable Windows support for interrupting REPL commands using
Ctrl+C by default, because the switches from console raw mode
and back have been interfering with printing the results of
evaluated expressions.

This is a temporary measure, since the underlying problem is
very likely not related to this specific feature.

Ref: https://github.com/nodejs/node/issues/7837

PR-URL: https://github.com/nodejs/node/pull/7977
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2016-08-08 09:43:32 -07:00
Franziska Hinkelmann
35109ddaf2 lib: remove double check of string type
checkIsHttpToken() already checks for typeof string. We do not
want to check twice.

PR-URL: https://github.com/nodejs/node/pull/7985
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-08 08:55:26 -07:00
cjihrig
2d4a521d58 repl: don't override all internal repl defaults
The createInternalRepl() module accepts an options object as an
argument. However, if one is provided, it overrides all of the
default options. This commit applies the options object to the
defaults, only changing the values that are explicitly set.

PR-URL: https://github.com/nodejs/node/pull/7826
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-08 11:03:18 -04: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
Pat Pannuto
a804db1af7
process: save original argv[0]
For historical and other reasons, node overwrites `argv[0]` on startup.
See
 - 2c6f79c08,
 - https://github.com/nodejs/node/issues/7434
 - https://github.com/nodejs/node/pull/7449
 - https://github.com/nodejs/node/pull/7696

For cases where it may be useful, save the original value of `argv[0]`
in `process.argv0`

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:33:57 +02:00
Anna Henningsen
8f90dcc1b8
buffer: throw on negative .allocUnsafe() argument
Add a check for `size < 0` to `assertSize()`, as passing a negative
value almost certainly indicates a programming error.

This also lines up the behaviour of `.allocUnsafe()` with the ones
of `.alloc()` and `.allocUnsafeSlow()` (which previously threw errors
from the Uint8Array constructor).

Notably, this also affects `Buffer()` calls with negative arguments.

PR-URL: https://github.com/nodejs/node/pull/7079
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
2016-08-08 15:04:21 +02:00
Prince J Wesley
b779eb423d
repl: Add editor mode support
```js
> node
> .editor
// Entering editor mode (^D to finish, ^C to cancel)
function test() {
  console.log('tested!');
}

test();

// ^D
tested!
undefined
>
```

PR-URL: https://github.com/nodejs/node/pull/7275
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-08-06 19:41:35 +05:30
yorkie
99296eedbe http: specify _implicitHeader in OutgoingMessage
PR-URL: https://github.com/nodejs/node/pull/7949
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-05 23:26:46 +08:00
Myles Borins
21b0a27af8
Revert "fs: make callback mandatory to all async functions"
This reverts commit 9359de9dd2.

Original Commit Message:

    The "fs" module has two functions called `maybeCallback` and
    `makeCallback`, as of now.

    The `maybeCallback` creates a default function to report errors, if the
    parameter passed is not a function object. Basically, if the callback
    is omitted in some cases, this function is used to create a default
    callback function.

    The `makeCallback`, OTOH, creates a default function only if the
    parameter passed is `undefined`, and if it is not a function object it
    will throw an `Error`.

    This patch removes the `maybeCallback` function and makes the callback
    function argument mandatory for all the async functions.

    PR-URL: https://github.com/nodejs/node/pull/7168
    Reviewed-By: Trevor Norris <trev.norris@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/7846
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-05 00:13:29 +02:00
Anna Henningsen
1a9e247c79
readline: show completions only after 2nd TAB
Show `TAB` completion suggestions only after the user has pressed `TAB`
twice in a row, so that the full list of suggestions doesn’t present
a distraction. The first time a `TAB` key is pressed, only partial
longest-common-prefix completion is performed.

This moves the `readline` autocompletion a lot closer to what e.g.
`bash` does.

Fixes: https://github.com/nodejs/node/issues/7665
PR-URL: https://github.com/nodejs/node/pull/7754
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 23:32:38 +02:00
Prince J Wesley
488d28d391 repl: deprecate unused function convertToContext
PR-URL: https://github.com/nodejs/node/pull/7829
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 12:59:50 -07:00
Myles Borins
c5a18e748d Revert "fs: validate args of truncate functions in js"
This reverts commit c86c1eeab5.

original commit message:

    This patch

     1. moves the basic validation of arguments to `truncate` family
        of functions to the JavaScript layer from the C++ layer.

     2. makes sure that the File Descriptors are validated strictly.

    PR-URL: #2498
    Reviewed-By: Trevor Norris <trev.norris@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/7950
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 09:37:17 -07:00
vladimir
320f433dcd util: support classes in util.deprecate()
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.

PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 11:44:40 -04:00
Anna Henningsen
1b24b37299
util: fix formatting of objects with SIMD enabled
When SIMD is enabled, `util.format` couldn’t display objects
(with at least 1 key) because the formatter function got
overridden.

PR-URL: https://github.com/nodejs/node/pull/7864
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2016-08-02 15:00:59 +02:00
cjihrig
75c6d9dd95 cluster: support stdio option for workers
This commit allows setupMaster() to configure the stdio channels
for worker processes.

Refs: https://github.com/nodejs/node-v0.x-archive/issues/5727
Refs: https://github.com/nodejs/node/pull/7811
PR-URL: https://github.com/nodejs/node/pull/7838
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-01 15:08:42 -04:00
Erin Spiceland
7d75338c0e timers: fix cleanup of nested same-timeout timers
For nested timers with the same timeout, we can get into a situation
where we have recreated a timer list immediately before we need to
clean up an old timer list with the same key. Fix: make sure the list
to be deleted is the same instance as the list whose reference was used
to determine that a cleanup is necessary. If it's not the same instance,
a new list with the same key has been created, and it should not be
deleted.

Fixes: https://github.com/nodejs/node/issues/7722

PR-URL: https://github.com/nodejs/node/pull/7827
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
2016-07-29 09:48:45 -07:00
Prince J Wesley
68ac0d0d7d
repl: Use displayErrors for SyntaxError
```js
node 🙈 ₹ git:(upstream  display-error-repl) ./node
> var 4;
var 4;
    ^
SyntaxError: Unexpected number

>
```

PR-URL: https://github.com/nodejs/node/pull/7589
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-07-27 21:26:06 +05:30
Evan Lucas
392c70a827 repl: prevent undefined ref in completion
Fixes: https://github.com/nodejs/node/issues/7716
PR-URL: https://github.com/nodejs/node/pull/7718
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-07-26 09:14:43 -05: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
Sakthipriyan Vairamani
c86c1eeab5 fs: validate args of truncate functions in js
This patch

 1. moves the basic validation of arguments to `truncate` family
    of functions to the JavaScript layer from the C++ layer.

 2. makes sure that the File Descriptors are validated strictly.

PR-URL: https://github.com/nodejs/node/pull/2498
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-07-22 03:58:33 +05:30
Sakthipriyan Vairamani
9359de9dd2 fs: make callback mandatory to all async functions
The "fs" module has two functions called `maybeCallback` and
`makeCallback`, as of now.

The `maybeCallback` creates a default function to report errors, if the
parameter passed is not a function object. Basically, if the callback
is omitted in some cases, this function is used to create a default
callback function.

The `makeCallback`, OTOH, creates a default function only if the
parameter passed is `undefined`, and if it is not a function object it
will throw an `Error`.

This patch removes the `maybeCallback` function and makes the callback
function argument mandatory for all the async functions.

PR-URL: https://github.com/nodejs/node/pull/7168
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-07-22 02:34:01 +05:30
ratikesh9
9983af0347 stream: improve unimplemented _write() error
This commit improves the ambiguous "not implemented" error
that is provided when a writable stream does not implement
_write().

Fixes: https://github.com/nodejs/node/issues/7396
PR-URL: https://github.com/nodejs/node/pull/7671
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-07-21 11:24:26 -04:00
cjihrig
2cc01da7f0 repl: default useGlobal to true
This is a partial revert of
15157c3c3d. This change lead to a
regression that broke require() in the CLI REPL, as imported
files were evaluated in a different context.

Refs: https://github.com/nodejs/node/pull/5703
Fixes: https://github.com/nodejs/node/issues/7788
PR-URL: https://github.com/nodejs/node/pull/7795
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-07-21 10:33:30 -04:00