2 // The Node team wants to deprecate `process.bind(...)`.
3 // https://github.com/nodejs/node/pull/2768
5 // However, we need the 'uv' binding for errname support.
6 // This is a defensive wrapper around it so `execa` will not fail entirely if it stops working someday.
8 // If this ever stops working. See: https://github.com/sindresorhus/execa/issues/31#issuecomment-215939939 for another possible solution.
12 uv = process.binding('uv');
14 if (typeof uv.errname !== 'function') {
15 throw new Error('uv.errname is not a function');
18 console.error('execa/lib/errname: unable to establish process.binding(\'uv\')', err);
22 function errname(uv, code) {
24 return uv.errname(code);
28 throw new Error('err >= 0');
31 return `Unknown system error ${code}`;
34 module.exports = code => errname(uv, code);
36 // used for testing the fallback behavior
37 module.exports.__test__ = errname;