summaryrefslogtreecommitdiff
path: root/test/sequential/test-child-process-execsync.js
AgeCommit message (Collapse)Author
2019-06-17lib: correct error.errno to always be numericJoyee Cheung
Historically `error.errno` of system errors thrown by Node.js can sometimes be the same as `err.code`, which are string representations of the error numbers. This is useless and incorrect, and results in an information loss for users since then they will have to resort to something like `process.binding('uv'[`UV_${errno}`])` to get to the numeric error codes. This patch corrects this behavior by always setting `error.errno` to be negative numbers. For fabricated errors like `ENOTFOUND`, `error.errno` is now undefined since there is no numeric equivalent for them anyway. For c-ares errors, `error.errno` is now undefined because the numeric representations (negated) can be in conflict with libuv error codes - this is fine since numeric codes was not available for c-ares errors anyway. Users can use the public API `util.getSystemErrorName(errno)` to retrieve string codes for these numbers. PR-URL: https://github.com/nodejs/node/pull/28140 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-12-31test: slightly refactor test-child-process-execsyncDenys Otrishko
* move `start` time to the point of execution (avoids counting 'throws' tests towards 'timeout' test case) * scope cmd/ret values where possible * use `filter` instead of manual if/return PR-URL: https://github.com/nodejs/node/pull/25227 Refs: https://github.com/nodejs/node/issues/24921 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-07-31test: improve assertions in child-process-execsyncbhavayAnand9
Improve assertions in test-child-process-execsync by removing unneeded third arguments and replacing equal checks with assert.ok() where appropriate. PR-URL: https://github.com/nodejs/node/pull/22016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-02-16test: remove assert.doesNotThrow()Ruben Bridgewater
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. PR-URL: https://github.com/nodejs/node/pull/18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-02-04test: verify the shell option works properly on execFilejvelezpo
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-01-03test: update references to archived repositoryTobias Nießen
PR-URL: https://github.com/nodejs/node/pull/17924 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-10-23child_process: restore exec{File}Sync error propsMichaël Zasso
In PR [1], a bunch of properties were removed from the error thrown by execSync and execFileSync. It turns out that some of those were still supposed to be there, as the documentation states that the error contains the entire result from the spawnSync call. [1] https://github.com/nodejs/node/pull/13601 PR-URL: https://github.com/nodejs/node/pull/16060 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-08test: improve assert messagesEric Pemberton
PR-URL: https://github.com/nodejs/node/pull/15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-07-21lib,src: fix consistent spacing inside bracesSebastiaan Deckers
PR-URL: https://github.com/nodejs/node/pull/14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-21doc, lib, test: do not re-require needlesslyVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/14244 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-05-05test: reduce string concatenationsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-03-10meta: restore original copyright headerJames M Snell
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-01-11test: use eslint to fix var->const/letGibson Fahnestock
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
2017-01-02test: use const for all require() callscjihrig
PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-11-02child_process: remove extra newline in errorscjihrig
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-10-24test: add coverage for execFileSync() errorscjihrig
This commit adds coverage for errors returned by execFileSync() when the child process exits with a non-zero code. PR-URL: https://github.com/nodejs/node/pull/9211 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-10-18test: remove unneeded escaping in template stringsRich Trott
The no-useless-escape rule in ESLint did not previously flag certain unnecessary escaping in template strings. These will be flagged in ESLint 3.8.0. PR-URL: https://github.com/nodejs/node/pull/9112 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
2016-07-19child_process: Check stderr before accessing itRobert Chiras
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-14test: cleanup IIFE testscjihrig
A number of test files use IIFEs to separate distinct tests from each other in the same file. The project has been moving toward using block scopes and let/const in favor of IIFEs. This commit moves IIFE tests to block scopes. Some additional cleanup such as use of strictEqual() and common.mustCall() is also included. PR-URL: https://github.com/nodejs/node/pull/7694 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-07-14test: add common.rootDircjihrig
A few of the child process tests can be simplified by computing the OS specific root directory in common and then accessing that value. PR-URL: https://github.com/nodejs/node/pull/7685 Reviewed-By: Roman Reiss <me@silverwind.io>
2016-04-22test,benchmark: use deepStrictEqual()Rich Trott
In preparation for a lint rule that will enforce assert.deepStrictEqual() over assert.deepEqual(), change tests and benchmarks accordingly. For tests and benchmarks that are testing or benchmarking assert.deepEqual() itself, apply a comment to ignore the upcoming rule. PR-URL: https://github.com/nodejs/node/pull/6213 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-16buffer: add .from(), .alloc() and .allocUnsafe()James M Snell
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-02-02test: fix redeclared vars in sequential testsRich Trott
PR-URL: https://github.com/nodejs/node/pull/4999 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-01-13test: fix style issues after eslint updateMichaël Zasso
Replace var keyword with const or let. PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-01test: remove unused modulesRich Trott
Many tests use require() to import modules that subsequently never gets used. This removes those imports and, in a few cases, removes other unused variables from tests. PR-URL: https://github.com/nodejs/node/pull/4475 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-10-14test: replace util with backtick stringsMyles Borins
Now that we have backticks we no longer need to use util.format to template strings! This commit was inspired by #3324, and it replaces instances of util.format with backtick strings in a number of tests Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/3359
2015-07-31test: use common.isWindows consistentlySakthipriyan Vairamani
In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-19test: enable linting for testsRoman Reiss
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-12test: fix ext commands to be double quotedShigeki Ohtsu
Paths used on the Windows command line need to be enclosed in double quotes, or they'll be parsed incorrectly when there are spaces in the path. PR-URL: https://github.com/iojs/io.js/pull/1122 Reviewed-by: Bert Belder <bertbelder@gmail.com>
2015-01-12Remove excessive copyright/license boilerplateisaacs
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.
2014-12-17test: split test in parallel/sequentialFedor Indutny
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: https://github.com/iojs/io.js/pull/172 Fix: iojs/io.js#139