summaryrefslogtreecommitdiff
path: root/modules/blog/util.js
blob: 933ff308c64fbc0a781c811171fbf02efccd211d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const child_process = require("child_process");


function runCommand(cmd, args) {
	console.log(`blog: ${cmd} ${JSON.stringify(args)}`);
	child_process.execFileSync(
		cmd, args,
		{ stdio: "inherit", timeout: 20000 }
	);
}

function runCommandOutput(cmd, args, opts) {
    if (opts == null) opts = {};
	if (!opts.silent) console.log(`blog: ${cmd} ${JSON.stringify(args)}`);
	return child_process.execFileSync(
		cmd, args,
		{ timeout: 20000 }
	);
}

module.exports = {
    runCommand,
    runCommandOutput,
};