script.js
async function run(command) {
    if (!Array.isArray(command) && typeof command === "string") command = command.split(' ');
    else throw new Error("command is either a string or a string array");
    let c = command.shift();
    let v = command;

    let env = process.env;
    env.BROWSERSLIST_CONFIG= "./config/.browserslistrc";


    return new Promise((resolve) => spawn(c, v,
        {
            stdio: "inherit",
            shell: true,
            env: env
        })
        .on("exit", (code, signal) => {
            if (fs.existsSync("./.nyc_output")) rimraf.sync("./.nyc_output"); 
            if (code === 0) resolve();
            else {
                console.log("ExternalError:", signal);
                process.exit(1);
            }
        })
    );
}
async function run(command) {
    if (!Array.isArray(command) && typeof command === "string") command = command.split(' ');
    else throw new Error("command is either a string or a string array");
    let c = command.shift();
    let v = command;

    let env = process.env;
    env.BROWSERSLIST_CONFIG= "./config/.browserslistrc";


    return new Promise((resolve) => spawn(c, v,
        {
            stdio: "inherit",
            shell: true,
            env: env
        })
        .on("exit", (code, signal) => {
            if (fs.existsSync("./.nyc_output")) rimraf.sync("./.nyc_output"); 
            if (code === 0) resolve();
            else {
                console.log("ExternalError:", signal);
                process.exit(1);
            }
        })
    );
}
async function run ( command ) { if ( ! Array . isArray ( command ) && typeof command === "string" ) command = command . split ( ' ' ) ; else throw new Error ( "command is either a string or a string array" ) ; let c = command . shift ( ) ; let v = command ; let env = process . env ; env . BROWSERSLIST_CONFIG = "./config/.browserslistrc" ; return new Promise ( ( resolve ) => spawn ( c , v , { stdio : "inherit" , shell : true , env : env } ) . on ( "exit" , ( code , signal ) => { if ( fs . existsSync ( "./.nyc_output" ) ) rimraf . sync ( "./.nyc_output" ) ; if ( code === 0 ) resolve ( ) ; else { console . log ( "ExternalError:" , signal ) ; process . exit ( 1 ) ; } } ) ) ; }
Executes the function as if its on the CMD. Exits the script if the external command crashes.
Executes the function as if its on the CMD . Exits the script if the external command crashes .