Skip to content

fix: Capture MSVC stdout/stderr when running from Visual Studio - #1170

Merged
jrosdahl merged 2 commits into
ccache:masterfrom
orgads:vs-capture
Oct 5, 2022
Merged

jrosdahl merged 2 commits into
ccache:masterfrom
orgads:vs-capture

Conversation

@orgads

@orgads orgads commented Oct 1, 2022

Copy link
Copy Markdown
Contributor

When VS_UNICODE_OUTPUT is set, CL sends its (unicode) output to VS using a side-channel. This prevents the option to capture the output.

Unset this variable to enable capturing the output.

@orgads

orgads commented Oct 1, 2022

Copy link
Copy Markdown
Contributor Author

@orgads

orgads commented Oct 1, 2022

Copy link
Copy Markdown
Contributor Author

@jrosdahl Would you prefer moving it somewhere else, to be done only once, and only for MSVC?

orgads added 2 commits October 1, 2022 20:46
putenv("FOO") doesn't really unset it. putnev("FOO=") sets an empty
value, which might be good for most cases, but for really unsetting
we need SetEnvironmentVariable("FOO", NULL).
When VS_UNICODE_OUTPUT is set, CL sends its (unicode) output to VS using a
side-channel. This prevents the option to capture the output.

Unset this variable to enable capturing the output.
@orgads

orgads commented Oct 1, 2022

Copy link
Copy Markdown
Contributor Author

@jrosdahl Would you prefer moving it somewhere else, to be done only once, and only for MSVC?

Done :)

@jrosdahl jrosdahl added issue: bug Does not work as intended/documented compiler: msvc Related to Microsoft Visual C++ labels Oct 5, 2022
@jrosdahl jrosdahl added this to the 4.7 milestone Oct 5, 2022
@jrosdahl

jrosdahl commented Oct 5, 2022

Copy link
Copy Markdown
Member

@jrosdahl Would you prefer moving it somewhere else, to be done only once, and only for MSVC?

Done :)

👍

@jrosdahl jrosdahl changed the title fix: Fix capturing stdout and stderr when running from Visual Studio fix: Capture MSVC stdout/stderr when running from Visual Studio Oct 5, 2022
@jrosdahl
jrosdahl merged commit c49fca9 into ccache:master Oct 5, 2022
@orgads
orgads deleted the vs-capture branch October 5, 2022 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler: msvc Related to Microsoft Visual C++ issue: bug Does not work as intended/documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants