1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Avoid exception if git not installed

This commit is contained in:
Nick O'Leary 2018-02-02 13:46:22 +00:00
parent df4beef060
commit d21568497b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -37,17 +37,19 @@ function runGitCommand(args,cwd,env) {
child.stdout.on('data', function(data) {
stdout += data;
});
child.stderr.on('data', function(data) {
stderr += data;
});
child.on('error', function(err) {
stderr = err.toString();
})
child.on('close', function(code) {
if (code !== 0) {
var err = new Error(stderr);
err.stdout = stdout;
err.stderr = stderr;
if (/fatal: could not read Username/.test(stderr)) {
if (/fatal: could not read/.test(stderr)) {
// Username/Password
err.code = "git_auth_failed";
} else if(/HTTP Basic: Access denied/.test(stderr)) {
err.code = "git_auth_failed";