(allArgs)
| 43 | // for spawn, allow a flat array of arguments where the |
| 44 | // the last arg can optionally be an options object |
| 45 | const getArgs = (allArgs) => { |
| 46 | let args = allArgs.flat().filter(Boolean) |
| 47 | let opts = {} |
| 48 | |
| 49 | const last = args[args.length - 1] |
| 50 | if (typeof last === 'object') { |
| 51 | args = args.slice(0, -1) |
| 52 | opts = last |
| 53 | } |
| 54 | |
| 55 | return { args, opts } |
| 56 | } |
| 57 | |
| 58 | const spawn = async (cmd, ...allArgs) => { |
| 59 | const { |