From a246f40d5de04c1c7fcc7385d36bc593bcee6ce6 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 1 Mar 2024 22:16:54 +0100 Subject: blog: Add timestamp to posts --- modules/blog/util.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/blog/util.js (limited to 'modules/blog/util.js') 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, +}; -- cgit v1.2.3-54-g00ecf