Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash options #9672

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"loc.input.label.workingDirectory": "Working Directory",
"loc.input.label.failOnStderr": "Fail on Standard Error",
"loc.input.help.failOnStderr": "If this is true, this task will fail if any errors are written to the StandardError stream.",
"loc.input.label.noProfile": "Don't load the profile startup/initialization files",
"loc.input.help.noProfile": "Don't load the system-wide startup file `/etc/profile' or any of the personal initialization files",
"loc.input.label.noRc": "Don't read the `~/.bashrc' initialization file",
"loc.messages.GeneratingScript": "Generating script.",
"loc.messages.JS_ExitCode": "Bash exited with code '%s'.",
"loc.messages.JS_FormattedCommand": "Formatted command: %s",
Expand Down
12 changes: 4 additions & 8 deletions Tasks/BashV3/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ const noRc = tl.getBoolInput('noRc');

async function translateDirectoryPath(bashPath: string, directoryPath: string): Promise<string> {
let bashPwd = tl.tool(bashPath)
.arg('--noprofile')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when translating windows paths to unix paths, we dont need to load the profile or rc file

.arg('--norc')
.arg('-c')
.arg('pwd');
if (noProfile) {
bashPwd.arg('--noprofile');
}
if (noRc) {
bashPwd.arg('--norc');
}

let bashPwdOptions = <tr.IExecOptions>{
cwd: directoryPath,
Expand Down Expand Up @@ -107,14 +103,14 @@ async function run() {

// Create the tool runner.
console.log('========================== Starting Command Output ===========================');
let bash = tl.tool(bashPath)
.arg(filePath);
let bash = tl.tool(bashPath);
if (noProfile) {
bash.arg('--noprofile');
}
if (noRc) {
bash.arg('--norc');
}
bash.arg(filePath);

let options = <tr.IExecOptions>{
cwd: input_workingDirectory,
Expand Down
2 changes: 1 addition & 1 deletion Tasks/BashV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 148,
"Patch": 1
"Patch": 2
},
"releaseNotes": "Script task consistency. Added support for multiple lines and added support for Windows.",
"minimumAgentVersion": "2.115.0",
Expand Down
19 changes: 18 additions & 1 deletion Tasks/BashV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 148,
"Patch": 1
"Patch": 2
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.115.0",
Expand Down Expand Up @@ -92,6 +92,23 @@
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.failOnStderr",
"groupName": "advanced"
},
{
"name": "noProfile",
"type": "boolean",
"label": "ms-resource:loc.input.label.noProfile",
"defaultValue": "true",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.noProfile",
"groupName": "advanced"
},
{
"name": "noRc",
"type": "boolean",
"label": "ms-resource:loc.input.label.noRc",
"defaultValue": "true",
"required": false,
"groupName": "advanced"
}
],
"execution": {
Expand Down