Co-authored-by: ikethirdweb <[email protected]> Co-authored-by: Joaquim Verges <[email protected]> Co-authored-by: Jonas Daniels <[email protected]>
23 lines
381 B
JavaScript
23 lines
381 B
JavaScript
import { exec } from "child_process";
|
|
|
|
/**
|
|
*
|
|
* @param {string[]} commands
|
|
* @returns
|
|
*/
|
|
export const execute = (commands) => {
|
|
return new Promise((res) => {
|
|
exec(commands.join("\n"), (err, stdout, stderr) => {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
|
|
if (stderr) {
|
|
console.error(stderr);
|
|
console.log("\n");
|
|
}
|
|
res();
|
|
});
|
|
});
|
|
};
|