Skip to content

Commit

Permalink
GH-7838: Fixed task execution on macOS with zsh.
Browse files Browse the repository at this point in the history
Switched to Xcode `11.4` on Travis CI to support macOS `10.15.4`.

Closes #7838.

Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
Akos Kitta committed May 26, 2020
1 parent ca6b505 commit c4e7651
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
- stage: test
os: linux
- os: osx
osx_image: xcode11.4
env: CXX=c++
before_script: skip
script:
Expand Down
8 changes: 1 addition & 7 deletions packages/process/src/common/shell-command-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export class ShellCommandBuilder {
return this.buildForCmd(args, cwd, env);
}
}
// If we cannot detect which shell is being used, don't escape.
console.warn(`Unknown shell, could not escape arguments: ${host || 'undefined'}`);
return this.buildForDefault(args, cwd, env);
return this.buildForBash(args, cwd, env);
}

protected buildForBash(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string {
Expand Down Expand Up @@ -150,8 +148,4 @@ export class ShellCommandBuilder {
return command;
}

protected buildForDefault(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string {
return args.join(' ');
}

}
4 changes: 4 additions & 0 deletions packages/task/src/node/process/process-task-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export class ProcessTaskRunner implements TaskRunner {
} else if (/(ps|pwsh|powershell)(.exe)?/.test(command)) {
quotingFunctions = PowershellQuotingFunctions;
execArgs = ['-c'];
} else {
quotingFunctions = BashQuotingFunctions;
execArgs = ['-l', '-c'];

}
// Allow overriding shell options from task configuration.
if (shell && shell.args) {
Expand Down
2 changes: 1 addition & 1 deletion packages/task/test-resources/task-long-running-osx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

for i in {1..300}
do
Expand Down
2 changes: 1 addition & 1 deletion packages/task/test-resources/task-osx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

for i in $@
do
Expand Down

0 comments on commit c4e7651

Please sign in to comment.