Skip to content

Commit fb59832

Browse files
Trim SshV0 task output newlines
1 parent 76ccc08 commit fb59832

File tree

10 files changed

+46
-22
lines changed

10 files changed

+46
-22
lines changed

Tasks/SshV0/ssh2helpers.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
147147
}).on('data', (data) => {
148148
if (data) {
149149
// "data" can be a buffer. Format it here so it outputs as a string
150-
console.log(data.toString('utf8'));
150+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
151+
console.log(data.toString('utf8').trim());
152+
} else {
153+
console.log(data.toString('utf8'));
154+
}
151155
if (!passwordSent) {
152156
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
153157
if (passwordSent) {
@@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
174178
}).on('data', (data) => {
175179
if (data) {
176180
// "data" can be a buffer. Format it here so it outputs as a string
177-
console.log(data.toString('utf8'));
181+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
182+
console.log(data.toString('utf8').trim());
183+
} else {
184+
console.log(data.toString('utf8'));
185+
}
178186
}
179187
}).stderr.on('data', (data) => {
180188
stdErrWritten = true;

Tasks/SshV0/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 0
2222
},
2323
"demands": [],

Tasks/SshV0/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 0
2222
},
2323
"demands": [],

_generated/SshV0.versionmap.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|0.245.0
2-
Node20-225|0.245.1
1+
Default|0.247.0
2+
Node20-225|0.247.1

_generated/SshV0/ssh2helpers.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
147147
}).on('data', (data) => {
148148
if (data) {
149149
// "data" can be a buffer. Format it here so it outputs as a string
150-
console.log(data.toString('utf8'));
150+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
151+
console.log(data.toString('utf8').trim());
152+
} else {
153+
console.log(data.toString('utf8'));
154+
}
151155
if (!passwordSent) {
152156
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
153157
if (passwordSent) {
@@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
174178
}).on('data', (data) => {
175179
if (data) {
176180
// "data" can be a buffer. Format it here so it outputs as a string
177-
console.log(data.toString('utf8'));
181+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
182+
console.log(data.toString('utf8').trim());
183+
} else {
184+
console.log(data.toString('utf8'));
185+
}
178186
}
179187
}).stderr.on('data', (data) => {
180188
stdErrWritten = true;

_generated/SshV0/task.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 0
2222
},
2323
"demands": [],
@@ -165,7 +165,7 @@
165165
"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"
166166
},
167167
"_buildConfigMapping": {
168-
"Default": "0.245.0",
169-
"Node20-225": "0.245.1"
168+
"Default": "0.247.0",
169+
"Node20-225": "0.247.1"
170170
}
171171
}

_generated/SshV0/task.loc.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 0
2222
},
2323
"demands": [],
@@ -165,7 +165,7 @@
165165
"ScriptArgsSanitized": "ms-resource:loc.messages.ScriptArgsSanitized"
166166
},
167167
"_buildConfigMapping": {
168-
"Default": "0.245.0",
169-
"Node20-225": "0.245.1"
168+
"Default": "0.247.0",
169+
"Node20-225": "0.247.1"
170170
}
171171
}

_generated/SshV0_Node20/ssh2helpers.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ export function runCommandOnRemoteMachine(
147147
}).on('data', (data) => {
148148
if (data) {
149149
// "data" can be a buffer. Format it here so it outputs as a string
150-
console.log(data.toString('utf8'));
150+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
151+
console.log(data.toString('utf8').trim());
152+
} else {
153+
console.log(data.toString('utf8'));
154+
}
151155
if (!passwordSent) {
152156
passwordSent = handlePasswordInput(data, stream, password, dataBuffer);
153157
if (passwordSent) {
@@ -174,7 +178,11 @@ export function runCommandOnRemoteMachine(
174178
}).on('data', (data) => {
175179
if (data) {
176180
// "data" can be a buffer. Format it here so it outputs as a string
177-
console.log(data.toString('utf8'));
181+
if (tl.getPipelineFeature("trimSshTaskOutput")) {
182+
console.log(data.toString('utf8').trim());
183+
} else {
184+
console.log(data.toString('utf8'));
185+
}
178186
}
179187
}).stderr.on('data', (data) => {
180188
stdErrWritten = true;

_generated/SshV0_Node20/task.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 1
2222
},
2323
"demands": [],
@@ -169,7 +169,7 @@
169169
"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"
170170
},
171171
"_buildConfigMapping": {
172-
"Default": "0.245.0",
173-
"Node20-225": "0.245.1"
172+
"Default": "0.247.0",
173+
"Node20-225": "0.247.1"
174174
}
175175
}

_generated/SshV0_Node20/task.loc.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 0,
20-
"Minor": 245,
20+
"Minor": 247,
2121
"Patch": 1
2222
},
2323
"demands": [],
@@ -169,7 +169,7 @@
169169
"ScriptArgsSanitized": "ms-resource:loc.messages.ScriptArgsSanitized"
170170
},
171171
"_buildConfigMapping": {
172-
"Default": "0.245.0",
173-
"Node20-225": "0.245.1"
172+
"Default": "0.247.0",
173+
"Node20-225": "0.247.1"
174174
}
175175
}

0 commit comments

Comments
 (0)