Skip to content

Commit

Permalink
fix(public/exec): fixes parallel args
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 30, 2019
1 parent bb50bf9 commit 7c2b0ea
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/@types/command-join.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'command-join' {
export default function commandJoin(args: string[]): string;
}
9 changes: 6 additions & 3 deletions src/public/exec/parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -43,8 +44,10 @@ const parallel: IParallel = (() => {
): (args?: string[]) => Promise<void> {
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(','));
Expand All @@ -59,7 +62,7 @@ const parallel: IParallel = (() => {
try {
await core.exec(
require.resolve('concurrently/bin/concurrently'),
args ? argv.concat(args) : argv,
argv,
true,
options
);
Expand Down

0 comments on commit 7c2b0ea

Please sign in to comment.