mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
13 lines
418 B
TypeScript
13 lines
418 B
TypeScript
import { exec } from 'child_process'
|
|
import { promisify } from 'util'
|
|
|
|
const execAsync = promisify(exec)
|
|
|
|
export async function runCommand(cmd: string, cwd: string = process.cwd()): Promise<{ stdout: string; stderr: string }> {
|
|
try {
|
|
return await execAsync(cmd, { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
} catch (error: any) {
|
|
return { stdout: error.stdout || '', stderr: error.stderr || error.message }
|
|
}
|
|
}
|