command.js
1 import { exec } from "child_process"; 2 import { promisify } from "util"; 3 4 export const execAsync = promisify(exec); 5 6 export async function runCommand(command) { 7 try { 8 const { stdout, stderr } = await execAsync(command); 9 return stdout; 10 } catch (error) { 11 console.error("Error:", error.message); 12 throw error; 13 } 14 }