Timer script should error properly if something goes wrong, and print out what happened.

This commit is contained in:
Daniel Patterson 2018-10-29 21:40:23 -07:00
parent 802ccfb497
commit 5327f8da4e
No known key found for this signature in database
GPG Key ID: 19C12BE1725A028B

View File

@ -6,8 +6,12 @@ var fs = require('fs');
var name = process.argv[2]; var name = process.argv[2];
var cmd = process.argv.slice(3).join(' '); var cmd = process.argv.slice(3).join(' ');
var start = Date.now(); var start = Date.now();
exec(cmd, (err) => { exec(cmd, (err, stdout, stderr) => {
if (err) return console.log(err); if (err) {
console.log(stdout);
console.log(stderr);
return process.exit(err.code);
}
var stop = +new Date(); var stop = +new Date();
var time = (stop - start) / 1000.; var time = (stop - start) / 1000.;
fs.appendFileSync('/tmp/osrm.timings', `${name}\t${time}`, 'utf-8'); fs.appendFileSync('/tmp/osrm.timings', `${name}\t${time}`, 'utf-8');