diff options
Diffstat (limited to 'modules/blog/util.js')
-rw-r--r-- | modules/blog/util.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/blog/util.js b/modules/blog/util.js new file mode 100644 index 0000000..933ff30 --- /dev/null +++ b/modules/blog/util.js @@ -0,0 +1,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, +}; |