blob: 512d78bbc4257d2b7a1aee8e321bb85301797390 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { execSync, ExecSyncOptions } from "child_process";
function exec(
command: string,
opts: ExecSyncOptions,
fallback?: string
): string | undefined {
try {
const rawResult = execSync(command, opts);
return rawResult.toString("utf8").trim();
} catch (err) {
return fallback || undefined;
}
}
export { exec };
|