Files
work-ts/commands.ts
2024-06-16 02:33:19 +08:00

36 lines
817 B
TypeScript

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