Skip to content

Fix berglas exec on Windows#287

Open
rodrigopimentel wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
rodrigopimentel:fix/exec-windows-support
Open

Fix berglas exec on Windows#287
rodrigopimentel wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
rodrigopimentel:fix/exec-windows-support

Conversation

@rodrigopimentel

Copy link
Copy Markdown

Summary

berglas exec fails on Windows with "not supported by windows" because syscall.Exec (execve) does not exist on Windows.

This replaces syscall.Exec with os/exec.Command, which is cross-platform and works on Linux, macOS, and Windows. The child process exit code is propagated to the caller.

Context

  • Windows binaries are already built and published via .goreleaser.yml (goos: ['darwin', 'linux', 'windows'])
  • The resolver and all other commands already handle Windows (e.g., resolver.go has chmodSupported = runtime.GOOS != "windows")
  • berglas exec is the only command broken on Windows
  • syscall.Exec was introduced in Switch to syscall/exec #172 to fix signal handling issues in k8s — this change preserves exit code propagation while restoring cross-platform support

Fixes the Windows portion of #171.

syscall.Exec (execve) does not exist on Windows, causing berglas exec
to fail with "not supported by windows" on all Windows builds.

Replace syscall.Exec with os/exec.Command which is cross-platform and
works on Linux, macOS, and Windows. The child process exit code is
propagated to the caller.
@google-cla

google-cla Bot commented Mar 31, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant