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

Redundant Debug Logging for ExecSync #1069

Closed
pbcahill opened this issue Sep 27, 2024 · 4 comments
Closed

Redundant Debug Logging for ExecSync #1069

pbcahill opened this issue Sep 27, 2024 · 4 comments

Comments

@pbcahill
Copy link

pbcahill commented Sep 27, 2024

Environment

azure-pipelines-task-lib version: 4.17.2

Issue Description

Whenever using the execSync function, and have system.debug enabled for the pipeline run, every piece of the command being output as a separate debug line twice:

{1AA92E14-9AFE-49B9-AEA4-8EC63D142470}

That is the result from using execSync to run a curl command:
{54205DC6-AB3A-4680-9A92-6D0C3CF5BA08}

Expected behaviour

I would expect whatever command is being executed to be debug logged on a single line. Also none of the debug lines should be duplicated.

Would also be nice to have an option for execSync to not debug log the command at all. The existing silent option only masks the regular console output.

Actual behaviour

Each piece or argument of the command is output on a new debug line and duplicated. No way to alter this behavior or mask.

Logs

@ivanduplenskikh
Copy link
Contributor

@pbcahill, appreciate the alert. I'll review the matter and respond promptly.

@ivanduplenskikh
Copy link
Contributor

@pbcahill, I successfully replicated the problem using a custom script task that make a request to a URL via the curl utility.
The core of this problem lies is how CmdLine/Bash/Powershell tasks are designed.
They utilize a tool wrapper which add listener for debug output. Then they subsequently invoke call exec method, which does the same action.

CmdLineV2:
tool listener
exec listener

BashV3:
tool listener
exec listener

PowershellV2:
tool listener
exec listener

Both these wrappers add listeners
tool
exec

Additionally, I'd like to point out that the 'silently' property does not impact the debug output.

@KonstantinTyukalov
Copy link
Contributor

@pbcahill thanks for pointing this out! It's fixed in newest patch, 4.17.3
I'm closing this bug, please let me know if you have any further questions.

@pbcahill
Copy link
Author

Thank you @KonstantinTyukalov and @ivanduplenskikh for the very prompt responses and resolutions! I have tested the new version in my extensions and the duplicate debug log lines are no more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants