From 3952f39c15b44abf961290455046bdfca4258ab6 Mon Sep 17 00:00:00 2001 From: Igor Klopov Date: Sat, 11 May 2019 10:59:33 +0300 Subject: [PATCH] node 8 changed from util.createPromise to new Promise as well --- prelude/bootstrap.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/prelude/bootstrap.js b/prelude/bootstrap.js index 6fa1cdd0a..216579e8d 100644 --- a/prelude/bootstrap.js +++ b/prelude/bootstrap.js @@ -1459,24 +1459,6 @@ function payloadFileSync (pointer) { if (promisify) { var custom = promisify.custom; var customPromisifyArgs = require('internal/util').customPromisifyArgs; - var createPromise; - - if (NODE_VERSION_MAJOR <= 8) { - var binding = process.binding('util'); - var promiseResolve = binding.promiseResolve; - var promiseReject = binding.promiseReject; - createPromise = function (fn) { - var p = binding.createPromise; - var resolve = promiseResolve.bind(p); - var reject = promiseReject.bind(p); - fn(resolve, reject); - return p; - }; - } else { - createPromise = function (fn) { - return new Promise(fn); - }; - } // ///////////////////////////////////////////////////////////// // FS ////////////////////////////////////////////////////////// @@ -1484,7 +1466,7 @@ function payloadFileSync (pointer) { Object.defineProperty(require('fs').exists, custom, { value: function (path) { - return createPromise(function (resolve) { + return new Promise(function (resolve) { require('fs').exists(path, function (exists) { resolve(exists); }); @@ -1507,7 +1489,7 @@ function payloadFileSync (pointer) { var customPromiseExecFunction = function (o) { return function () { var args = Array.from(arguments); - return createPromise(function (resolve, reject) { + return new Promise(function (resolve, reject) { o.apply(undefined, args.concat(function (error, stdout, stderr) { if (error !== null) { error.stdout = stdout;