mirror of
https://gh-proxy.org/https://github.com/klinsmaya/portal-template-default.git
synced 2026-11-08 00:57:57 +08:00
11 lines
476 B
JavaScript
11 lines
476 B
JavaScript
import { spawnSync } from 'node:child_process';
|
|
import { recordTiming } from './timing.mjs';
|
|
const [stage, command, ...args] = process.argv.slice(2);
|
|
if (!stage || !command)
|
|
throw new Error('Usage: timed-command.mjs <stage> <command> [args]');
|
|
const started = Date.now();
|
|
const result = spawnSync(command, args, { stdio: 'inherit' });
|
|
recordTiming(stage, started, result.status ?? 1);
|
|
if (result.error) console.error(result.error.message);
|
|
process.exit(result.status ?? 1);
|