From 894d28c60b3af86c9c2796a77e4f3a31fd54874c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 11 Feb 2019 09:01:40 +0000 Subject: [PATCH] Remove remnants of when library in git/index Fixes #2057 --- .../localfilesystem/projects/git/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js index 214a9e615..ae93f149a 100644 --- a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js +++ b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/git/index.js @@ -14,8 +14,6 @@ * limitations under the License. **/ -var when = require('when'); - var exec = require("../../../../exec"); var authResponseServer = require('./authServer').ResponseServer; @@ -84,8 +82,12 @@ function runGitCommandWithAuth(args,cwd,auth,emit) { commandEnv.NODE_RED_GIT_NODE_PATH = process.execPath; commandEnv.NODE_RED_GIT_SOCK_PATH = rs.path; commandEnv.NODE_RED_GIT_ASKPASS_PATH = path.join(__dirname,"authWriter.js"); - return runGitCommand(args,cwd,commandEnv,emit).finally(function() { + return runGitCommand(args,cwd,commandEnv,emit).then( result => { rs.close(); + return result; + }).catch(err => { + rs.close(); + throw err; }); }) } @@ -104,8 +106,12 @@ function runGitCommandWithSSHCommand(args,cwd,auth,emit) { // GIT_SSH_COMMAND - added in git 2.3.0 commandEnv.GIT_SSH_COMMAND = "ssh -i " + auth.key_path + " -F /dev/null"; // console.log('commandEnv:', commandEnv); - return runGitCommand(args,cwd,commandEnv,emit).finally(function() { + return runGitCommand(args,cwd,commandEnv,emit).then( result => { rs.close(); + return result; + }).catch(err => { + rs.close(); + throw err; }); }) } @@ -362,7 +368,7 @@ function getBranchStatus(cwd,remoteBranch) { // #commits master behind runGitCommand(['rev-list', '^HEAD',remoteBranch, '--count'],cwd) ]; - return when.all(commands).then(function(results) { + return Promise.all(commands).then(function(results) { return { commits: { ahead: parseInt(results[0]), @@ -589,7 +595,7 @@ module.exports = { runGitCommand(['rev-list', 'HEAD', '--count'],cwd), runGitCommand(args,cwd).then(parseLog) ]; - return when.all(commands).then(function(results) { + return Promise.all(commands).then(function(results) { var result = results[0]; result.count = results[1].length; result.before = before;