Skip to content

Use set on Windows, not export #116745

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ilonatommy
Copy link
Member

Found in library logs: #116695 (comment).

'export' is not recognized as an internal or external command

log

TargetOS is browser and command form should not depend on it. The change removes the error from logs.

@ilonatommy ilonatommy requested review from akoeplinger and maraf June 17, 2025 14:58
@ilonatommy ilonatommy self-assigned this Jun 17, 2025
@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 14:58
@ilonatommy ilonatommy added the arch-wasm WebAssembly architecture label Jun 17, 2025
@ilonatommy ilonatommy changed the title Use set on Windows, not `export' Use set on Windows, not export Jun 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an issue from runtime logs by correcting the command used for setting environment variables on Windows.

  • Replace condition from using "$(TargetOS)" to using "$(OS)" for proper Windows detection.
  • Update both Windows and non-Windows branches to ensure the appropriate command ("set" for Windows, "export" for others) is used.
Comments suppressed due to low confidence (2)

eng/testing/xunit/xunit.console.targets:16

  • Ensure that the $(OS) variable is consistently set in all expected environments; if there is any risk it might be missing in some CI configurations, consider adding a fallback or additional documentation.
    <SetScriptCommands Condition="'$(OS)' == 'Windows_NT'" Include="set XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />

eng/testing/xunit/xunit.console.targets:17

  • Verify that using the $(OS) condition for non-Windows environments reliably covers all target platforms, and document any assumptions if necessary.
    <SetScriptCommands Condition="'$(OS)' != 'Windows_NT'" Include="export XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 17, 2025
@lewing
Copy link
Member

lewing commented Jun 17, 2025

This keeps getting flipped back and forth https://github.com/dotnet/runtime/pull/107349/files

@ilonatommy
Copy link
Member Author

ilonatommy commented Jun 18, 2025

This keeps getting flipped back and forth https://github.com/dotnet/runtime/pull/107349/files

We can wait for @pavelsavara but looking in the binlog, the check for TargetOS does not make sense.

javascript.interop.tests.binlog.zip

image

image

image

@ilonatommy ilonatommy requested a review from pavelsavara June 18, 2025 07:37
Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have non trivial amount placed where we set envvars like this. We have to always duplicate the lines. Could we do better?

@maraf
Copy link
Member

maraf commented Jun 18, 2025

This keeps getting flipped back and forth https://github.com/dotnet/runtime/pull/107349/files

Wasm.Build.Tests use OS as well

@ilonatommy
Copy link
Member Author

ilonatommy commented Jun 18, 2025

We have non trivial amount placed where we set envvars like this. We have to always duplicate the lines. Could we do better?

For this particular case (envvar setting) we could have

<PropertyGroup>
  <EnvVarCommand Condition="'$(OS)' == 'Windows_NT'">set</EnvVarCommand>
  <EnvVarCommand Condition="'$(OS)' != 'Windows_NT'">export</EnvVarCommand>
</PropertyGroup>

<ItemGroup>
  <SetScriptCommands Include="$(EnvVarCommand) XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
</ItemGroup>

not yet sure where to set the 1st part, to be early enough for all the test cases.

Edit:
we also are checking for Condition="'$(TargetsWindows)' == 'true' or '$(TargetPlatformIdentifier)' == 'windows'"

<RunScriptCommands Condition="'$(TargetsWindows)' == 'true' or '$(TargetPlatformIdentifier)' == 'windows'" Include="set MONO_ENV_OPTIONS='$(MonoEnvOptions)'" />

for WindowsShell in helix-related actions and for TestWrapperTargetsWindows in helix&arcade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants