Skip to content

build.ps1 should detect Windows without requiring OS=Windows_NT #821

Description

@TheAngryPit

Summary

build.ps1 currently treats a Windows host as unsupported when the OS environment variable is missing, even though PowerShell/.NET can identify the platform directly.

I hit this on a Windows Insider/preview host (25H2, build 26200.8737) from a PowerShell 7 process where $env:OS was not populated. The script failed at the prerequisite stage with This project requires Windows despite running on Windows.

Reproduction

From a Windows PowerShell 7 session:

$env:OS = $null
.\build.ps1 -CheckOnly

Before the fix, the OS prerequisite check fails because it only checks:

$env:OS -ne "Windows_NT"

Expected behavior

build.ps1 should detect Windows from the host/runtime, not from a mutable optional environment variable.

Proposed fix

Use PowerShell's $IsWindows automatic variable when available, with a Windows PowerShell-compatible fallback through [System.Environment]::OSVersion.Platform.

Local validation

On Windows 25H2 build 26200.8737:

  • ./build.ps1 -CheckOnly with $env:OS = $null passed and reported Windows detected.
  • ./build.ps1 with $env:OS = $null passed.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore passed: 2417 passed, 29 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore passed: 1154 passed.
  • openclaw-autoreview on the one-file diff reported no accepted/actionable findings.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions