|
|
@ -188,6 +188,25 @@ exports.p = function () { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
function pad (n) { |
|
|
|
return n < 10 ? '0' + n.toString(10) : n.toString(10); |
|
|
|
} |
|
|
|
|
|
|
|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; |
|
|
|
|
|
|
|
// 26 Feb 16:19:34
|
|
|
|
function timestamp () { |
|
|
|
var d = new Date(); |
|
|
|
return [ d.getDate() |
|
|
|
, months[d.getMonth()] |
|
|
|
, [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':') |
|
|
|
].join(' '); |
|
|
|
} |
|
|
|
|
|
|
|
exports.log = function (msg) { |
|
|
|
exports.puts(timestamp() + ' - ' + msg.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
exports.exec = function (command, callback) { |
|
|
|
var child = process.createChildProcess("/bin/sh", ["-c", command]); |
|
|
|
var stdout = ""; |
|
|
|