diff --git a/package-lock.json b/package-lock.json index 3493b39..fe9f49f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2203,6 +2203,11 @@ "delayed-stream": "~1.0.0" } }, + "command-join": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/command-join/-/command-join-2.0.0.tgz", + "integrity": "sha1-Uui5hPSHLZUv8b3IuYOX0nxxRM8=" + }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", diff --git a/package.json b/package.json index 9448190..af43595 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,7 @@ "arg": "^4.1.0", "as-table": "^1.0.38", "cli-belt": "^0.3.0", + "command-join": "^2.0.0", "common-tags": "^1.8.0", "concurrently": "^4.1.0", "errorish": "^0.3.0", diff --git a/src/@types/command-join.ts b/src/@types/command-join.ts new file mode 100644 index 0000000..9d23596 --- /dev/null +++ b/src/@types/command-join.ts @@ -0,0 +1,3 @@ +declare module 'command-join' { + export default function commandJoin(args: string[]): string; +} diff --git a/src/public/exec/parallel.ts b/src/public/exec/parallel.ts index a54273e..c28ece9 100644 --- a/src/public/exec/parallel.ts +++ b/src/public/exec/parallel.ts @@ -3,6 +3,7 @@ import { IExecOptions, IOfType } from '~/types'; import logger from '~/utils/logger'; import { wrap } from '~/utils/errors'; import expose from '~/utils/expose'; +import join from 'command-join'; export interface IParallelOptions extends IExecOptions { names?: string[]; @@ -43,8 +44,10 @@ const parallel: IParallel = (() => { ): (args?: string[]) => Promise { return async (args?: string[]) => { const argv: string[] = Array.isArray(commands) - ? commands.concat() - : [commands]; + ? commands.map( + (command) => command + (args && args.length ? ` ${join(args)}` : '') + ) + : [commands + (args && args.length ? ` ${join(args)}` : '')]; if (options.names && options.names.length) { argv.push('--names', options.names.join(',')); @@ -59,7 +62,7 @@ const parallel: IParallel = (() => { try { await core.exec( require.resolve('concurrently/bin/concurrently'), - args ? argv.concat(args) : argv, + argv, true, options );