index.js
async function executeCommands(commands, ignoreErrorFunc, option) {
    const ret = [];
    for (const cmd of commands) {
        const r = await executeCommand(cmd, option).catch((e) => {
            if (ignoreErrorFunc && ignoreErrorFunc(cmd)) {
                // ignore error
                return '';
            }
            throw e;
        });
        ret.push(r);
    }
    return ret;
}
async function executeCommands(commands, ignoreErrorFunc, option) {
    const ret = [];
    for (const cmd of commands) {
        const r = await executeCommand(cmd, option).catch((e) => {
            if (ignoreErrorFunc && ignoreErrorFunc(cmd)) {
                // ignore error
                return '';
            }
            throw e;
        });
        ret.push(r);
    }
    return ret;
}
async function executeCommands ( commands , ignoreErrorFunc , option ) { const ret = [ ] ; for ( const cmd of commands ) { const r = await executeCommand ( cmd , option ) . catch ( ( e ) => { if ( ignoreErrorFunc && ignoreErrorFunc ( cmd ) ) { // ignore error return '' ; } throw e ; } ) ; ret . push ( r ) ; } return ret ; }
Execute commands with sudo
@param {Array.<Array.<string>>} commands : Array of command list
@param {function} ignoreErrorFunc : Handler for determining whether to ignore when command fails
@param {object} [option] : option parameter
@return {Promise} Return standard output of each command as an array
Execute commands with sudo