From bf05d18d4a209be2f9bcd47873a6e27c09e32bc2 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Sun, 16 Jun 2024 02:33:19 +0800 Subject: [PATCH] commands: init --- commands.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 commands.ts diff --git a/commands.ts b/commands.ts new file mode 100644 index 0000000..ce7fc04 --- /dev/null +++ b/commands.ts @@ -0,0 +1,35 @@ +/** + * Command CLI generation + */ + + +/** + * Constructs a systemd-run command array. + * @param unit The systemd unit to run. + * @param workingDirectory The working directory for the systemd-run command. + * Defaults to the current working directory. + * @returns An array representing the systemd-run command. + */ +export function systemdRun(unit: string, workingDirectory: string = process.cwd()): string[] { + return [ + 'systemd-run', + '--user', + `--working-directory=${workingDirectory}`, + '--unit', + unit + ]; +} + +export function runcpu(workload: string = 'test'): string[] { + return [ + "runcpu", + "-c", + "clang-O2", + "-i", + workload, + "pop2_s", + "--action", + "run", + "--nobuild", + ]; +}