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", + ]; +}