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

Modify the SshV0 task to direct the output to process.stdout instead of the console.log #20507

Merged
merged 2 commits into from
Oct 8, 2024
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
12 changes: 10 additions & 2 deletions Tasks/SshV0/ssh2helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
ivanduplenskikh marked this conversation as resolved.
Show resolved Hide resolved
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
if (!passwordSent) {
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
if (passwordSent) {
Expand All @@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
}
}).stderr.on('data', (data) => {
stdErrWritten = true;
Expand Down
2 changes: 1 addition & 1 deletion Tasks/SshV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/SshV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 0
},
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions _generated/SshV0.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|0.245.0
Node20-225|0.245.1
Default|0.247.0
Node20-225|0.247.1
12 changes: 10 additions & 2 deletions _generated/SshV0/ssh2helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
if (!passwordSent) {
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
if (passwordSent) {
Expand All @@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
}
}).stderr.on('data', (data) => {
stdErrWritten = true;
Expand Down
6 changes: 3 additions & 3 deletions _generated/SshV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -165,7 +165,7 @@
"ScriptArgsSanitized": "Detected characters in arguments that may not be executed correctly by the shell. Please escape special characters using backslash (\\). More information is available here: https://aka.ms/ado/75787"
},
"_buildConfigMapping": {
"Default": "0.245.0",
"Node20-225": "0.245.1"
"Default": "0.247.0",
"Node20-225": "0.247.1"
}
}
6 changes: 3 additions & 3 deletions _generated/SshV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -165,7 +165,7 @@
"ScriptArgsSanitized": "ms-resource:loc.messages.ScriptArgsSanitized"
},
"_buildConfigMapping": {
"Default": "0.245.0",
"Node20-225": "0.245.1"
"Default": "0.247.0",
"Node20-225": "0.247.1"
}
}
12 changes: 10 additions & 2 deletions _generated/SshV0_Node20/ssh2helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
if (!passwordSent) {
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
if (passwordSent) {
Expand All @@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
}).on('data', (data) => {
if (data) {
// "data" can be a buffer. Format it here so it outputs as a string
console.log(data.toString('utf8'));
if (tl.getPipelineFeature("redirectTaskOutputToProcessStdout")) {
process.stdout.write(data);
} else {
console.log(data.toString('utf8'));
}
}
}).stderr.on('data', (data) => {
stdErrWritten = true;
Expand Down
6 changes: 3 additions & 3 deletions _generated/SshV0_Node20/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 1
},
"demands": [],
Expand Down Expand Up @@ -169,7 +169,7 @@
"ScriptArgsSanitized": "Detected characters in arguments that may not be executed correctly by the shell. Please escape special characters using backslash (\\). More information is available here: https://aka.ms/ado/75787"
},
"_buildConfigMapping": {
"Default": "0.245.0",
"Node20-225": "0.245.1"
"Default": "0.247.0",
"Node20-225": "0.247.1"
}
}
6 changes: 3 additions & 3 deletions _generated/SshV0_Node20/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 245,
"Minor": 247,
"Patch": 1
},
"demands": [],
Expand Down Expand Up @@ -169,7 +169,7 @@
"ScriptArgsSanitized": "ms-resource:loc.messages.ScriptArgsSanitized"
},
"_buildConfigMapping": {
"Default": "0.245.0",
"Node20-225": "0.245.1"
"Default": "0.247.0",
"Node20-225": "0.247.1"
}
}