mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-25 15:54:03 +00:00
20 lines
437 B
JavaScript
20 lines
437 B
JavaScript
|
#!/usr/bin/env node
|
||
|
|
||
|
const childProcess = require("child_process");
|
||
|
let env = process.env;
|
||
|
|
||
|
let cmd = process.argv[2];
|
||
|
let args = process.argv.slice(3);
|
||
|
let replacedArgs = [];
|
||
|
|
||
|
for (let arg of args) {
|
||
|
for (let key in env) {
|
||
|
arg = arg.replaceAll(`$${key}`, env[key]);
|
||
|
}
|
||
|
replacedArgs.push(arg);
|
||
|
}
|
||
|
|
||
|
let child = childProcess.spawn(cmd, replacedArgs);
|
||
|
child.stdout.pipe(process.stdout);
|
||
|
child.stderr.pipe(process.stderr);
|