summaryrefslogtreecommitdiff
path: root/modules/blog/util.js
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-03-01 22:16:54 +0100
committerTom Smeding <tom@tomsmeding.com>2024-03-01 22:16:54 +0100
commita246f40d5de04c1c7fcc7385d36bc593bcee6ce6 (patch)
tree10114424db8779dcb8680203623cc1a2e829f38d /modules/blog/util.js
parent9fa687bbf6be41ab54e38ee7e567890a16287032 (diff)
blog: Add timestamp to posts
Diffstat (limited to 'modules/blog/util.js')
-rw-r--r--modules/blog/util.js24
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,
+};