diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-01-17 03:21:16 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-01-20 08:51:47 +0800 |
commit | 4af1bba6d0f1da1b4d444ef3a936e2ef2c639a1e (patch) | |
tree | ae8a75b9ac85984da88ee4af569215b94befd1b5 /test/parallel/test-child-process-execfile.js | |
parent | cbd634947d3aa308266ac6192a5af0a30445a449 (diff) | |
download | android-node-v8-4af1bba6d0f1da1b4d444ef3a936e2ef2c639a1e.tar.gz android-node-v8-4af1bba6d0f1da1b4d444ef3a936e2ef2c639a1e.tar.bz2 android-node-v8-4af1bba6d0f1da1b4d444ef3a936e2ef2c639a1e.zip |
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>
Diffstat (limited to 'test/parallel/test-child-process-execfile.js')
-rw-r--r-- | test/parallel/test-child-process-execfile.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-child-process-execfile.js b/test/parallel/test-child-process-execfile.js index 62cc7f534d..415489e9db 100644 --- a/test/parallel/test-child-process-execfile.js +++ b/test/parallel/test-child-process-execfile.js @@ -1,8 +1,9 @@ 'use strict'; + const common = require('../common'); const assert = require('assert'); const execFile = require('child_process').execFile; -const uv = process.binding('uv'); +const { getSystemErrorName } = require('util'); const fixtures = require('../common/fixtures'); const fixture = fixtures.path('exit.js'); @@ -26,7 +27,7 @@ const fixture = fixtures.path('exit.js'); const code = -1; const callback = common.mustCall((err, stdout, stderr) => { assert.strictEqual(err.toString().trim(), errorString); - assert.strictEqual(err.code, uv.errname(code)); + assert.strictEqual(err.code, getSystemErrorName(code)); assert.strictEqual(err.killed, true); assert.strictEqual(err.signal, null); assert.strictEqual(err.cmd, process.execPath); |