Skip to content

Commit

Permalink
Revert "Execute bash script instead of sourcing (#9534)"
Browse files Browse the repository at this point in the history
This reverts commit 676cd20.
  • Loading branch information
Danny McCormick authored Oct 16, 2019
1 parent 198956c commit ad82c61
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
16 changes: 1 addition & 15 deletions Tasks/BashV3/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ async function run() {
let input_filePath: string;
let input_arguments: string;
let input_script: string;
let old_source_behavior: boolean;
let input_targetType: string = tl.getInput('targetType') || '';
if (input_targetType.toUpperCase() == 'FILEPATH') {
old_source_behavior = tl.getBoolInput('AZP_BASHV3_OLD_SOURCE_BEHAVIOR', /*required*/ false);
input_filePath = tl.getPathInput('filePath', /*required*/ true);
if (!tl.stats(input_filePath).isFile()) {
throw new Error(tl.loc('JS_InvalidFilePath', input_filePath));
Expand All @@ -74,19 +72,7 @@ async function run() {
targetFilePath = input_filePath;
}

if (old_source_behavior) {
contents = `. '${targetFilePath.replace("'", "'\\''")}' ${input_arguments}`.trim();
} else {
// Check if executable bit is set
let stats: fs.Stats = fs.statSync(targetFilePath);
if ((stats.mode & 1) > 0) {
contents = `bash '${targetFilePath.replace("'", "'\\''")}' ${input_arguments}`.trim();
}
else {
tl.warning('Executable bit is not set on target script, sourcing instead of executing. More info at https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/bashnote.md');
contents = `. '${targetFilePath.replace("'", "'\\''")}' ${input_arguments}`.trim();
}
}
contents = `. '${targetFilePath.replace("'", "'\\''")}' ${input_arguments}`.trim();
console.log(tl.loc('JS_FormattedCommand', contents));
}
else {
Expand Down
4 changes: 2 additions & 2 deletions Tasks/BashV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 159,
"Patch": 2
"Minor": 151,
"Patch": 3
},
"releaseNotes": "Script task consistency. Added support for multiple lines and added support for Windows.",
"minimumAgentVersion": "2.115.0",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/BashV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 159,
"Patch": 2
"Minor": 151,
"Patch": 3
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.115.0",
Expand Down
15 changes: 0 additions & 15 deletions docs/bashnote.md

This file was deleted.

0 comments on commit ad82c61

Please sign in to comment.