You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to use tl.execAsync to read the contents from a command's stdout I have encountered an issue where diagnostic information containing the command name and arguments are injected into the output stream.
This JavaScript below serves as a minimal reproduction of the issue.
constassert=require("node:assert");constfs=require("node:fs");const{ readFile, writeFile }=require("node:fs/promises");consttl=require("azure-pipelines-task-lib/task");(async()=>{// Write "Hello World!" to foo.txt.constfooContents="Hello, World!";awaitwriteFile("foo.txt",fooContents);// Create an optional write stream to bar.txt.conststream=fs.createWriteStream("bar.txt");constoptions={outStream: stream};awaittl.execAsync("cat",["foo.txt"],options);// Read back the contents of bar.txt.constbarContents=awaitreadFile("bar.txt","utf-8");// 💣💥 Boom! They aren't equal! bar.txt is prefixed with:// [command]/usr/bin/cat foo.txtassert.strictEqual(fooContents,barContents,`foo.txt: "${fooContents}" != bar.txt: "${barContents}"`,);})();
I don't know whether there are contexts where it would make sense to have this output in the stream coming from the subprocess, so I'm not sure if this is intentional, but it seems like bug to me. I think that the following code is responsible for the issue.
When attempting to use
tl.execAsync
to read the contents from a command'sstdout
I have encountered an issue where diagnostic information containing the command name and arguments are injected into the output stream.This JavaScript below serves as a minimal reproduction of the issue.
I don't know whether there are contexts where it would make sense to have this output in the stream coming from the subprocess, so I'm not sure if this is intentional, but it seems like bug to me. I think that the following code is responsible for the issue.
azure-pipelines-task-lib/node/toolrunner.ts
Lines 612 to 614 in 40040a0
Unfortunately, if you try to suppress this output by setting
silent: true
in the options then the entire output is supressed, which is not desirable.The text was updated successfully, but these errors were encountered: