Files
metabuilder/tools/refactoring/cli/utils/run-command.ts

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 }
}
}