Reduce verbosity of output in test/webbrowser.js

This commit is contained in:
Rob Wu 2015-07-17 23:21:35 +02:00
parent c3c6d503ee
commit cc0805a996

View File

@ -158,22 +158,25 @@ WebBrowser.prototype = {
return pgrepStatus === 1; // "No process matched.", per man pgrep. return pgrepStatus === 1; // "No process matched.", per man pgrep.
}; };
} }
function execAsyncNoStdin(cmd, silent, onExit) { function execAsyncNoStdin(cmd, onExit) {
var proc = shelljs.exec(cmd, { var proc = shelljs.exec(cmd, {
async: true, async: true,
silent: silent === true, silent: true,
}, onExit); }, onExit);
// Close stdin, otherwise wmic won't run. // Close stdin, otherwise wmic won't run.
proc.stdin.end(); proc.stdin.end();
} }
var killDateStart = Date.now(); var killDateStart = Date.now();
// Note: First process' output it shown, the later outputs are suppressed. // Note: First process' output it shown, the later outputs are suppressed.
execAsyncNoStdin(cmdKillAll, false, function checkAlive() { execAsyncNoStdin(cmdKillAll, function checkAlive(exitCode, firstStdout) {
execAsyncNoStdin(cmdCheckAllKilled, true, function(exitCode, stdout) { execAsyncNoStdin(cmdCheckAllKilled, function(exitCode, stdout) {
if (isAllKilled(exitCode, stdout)) { if (isAllKilled(exitCode, stdout)) {
callback(); callback();
} else if (Date.now() - killDateStart > 10000) { } else if (Date.now() - killDateStart > 10000) {
// Should finish termination within 10 (generous) seconds. // Should finish termination within 10 (generous) seconds.
if (firstStdout) {
this.log('Output of first command:\n' + firstStdout);
}
if (stdout) { if (stdout) {
this.log('Output of last command:\n' + stdout); this.log('Output of last command:\n' + stdout);
} }