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

Add debug to sshkeygen for travis

This commit is contained in:
Nick O'Leary 2018-01-19 12:50:12 +00:00
parent 85fc20b52d
commit 353de471eb
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -22,32 +22,41 @@ var log;
function runSshKeygenCommand(args,cwd,env) { function runSshKeygenCommand(args,cwd,env) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
var child = child_process.spawn(sshkeygenCommand, args, {cwd: cwd, detached: true, env: env}); console.log("Spawning command",args);
var stdout = ""; try {
var stderr = ""; var child = child_process.spawn(sshkeygenCommand, args, {cwd: cwd, detached: true, env: env});
var stdout = "";
var stderr = "";
child.stdout.on('data', function(data) { child.stdout.on('data', function(data) {
stdout += data; stdout += data;
}); });
child.stderr.on('data', function(data) { child.stderr.on('data', function(data) {
stderr += data; stderr += data;
}); });
child.on('close', function(code, signal) { child.on('close', function(code, signal) {
if (code !== 0) { console.log("sshKeyGen closed",code);
var err = new Error(stderr); console.log("sshKeyGen",stdout);
err.stdout = stdout; console.log("sshKeyGen",stderr);
err.stderr = stderr; if (code !== 0) {
if (/passphrase is too short/.test(stderr)) { var err = new Error(stderr);
err.code = "key_passphrase_too_short"; err.stdout = stdout;
} else if(/Key must at least be 1024 bits/.test(stderr)) { err.stderr = stderr;
err.code = "key_length_too_short"; if (/passphrase is too short/.test(stderr)) {
err.code = "key_passphrase_too_short";
} else if(/Key must at least be 1024 bits/.test(stderr)) {
err.code = "key_length_too_short";
}
reject(err);
} }
reject(err); else {
} resolve(stdout);
else { }
resolve(stdout); });
} } catch(err) {
}); console.log("Threw error",err);
reject(err);
}
}); });
} }