Skip to content

Windows support 1/x: centipede:command. - #2174

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/959298250
Open

Windows support 1/x: centipede:command.#2174
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/959298250

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Windows support 1/x: centipede:command.

Command previously relied on posix_spawn with /bin/sh, the POSIX env utility for environment variable modifications, and shell < redirection syntax in arguments. These mechanisms are not portable to Windows.

Refactor Command to support native Windows process management alongside POSIX:

  • Introduce Command::PlatformContext to encapsulate platform-specific process handles (HANDLE on Windows vs. pid_t and ForkServerProps on POSIX).

  • Implement Windows process creation, environment block construction (Options::env_diff), and standard stream redirection in Command::ExecuteAsync() using CreateProcessA.

  • Add Options::stdin_file_path to handle input redirection directly rather than appending "<" to command arguments, and update SymbolTable to use it.

  • Escape command-line arguments, environment variables, and file paths in Command::ToString() on both POSIX (ShellEscape) and Windows.

  • Update command_test_helper and command_test to verify arguments, environment variables, standard input, and signals portably without relying on bash, and enable centipede:command_test on Windows CI.

  • Update GetDataDependencyFilepath to return executable path suffixed with .exe under Windows.

@copybara-service
copybara-service Bot force-pushed the cl/959298250 branch 14 times, most recently from 25e5dc4 to 478c3a3 Compare August 6, 2026 02:06
@copybara-service copybara-service Bot changed the title No public description Windows support 1/x: centipede:command Sep 3, 2026
@copybara-service copybara-service Bot changed the title Windows support 1/x: centipede:command Windows support 1/x: centipede:command. Sep 8, 2026
@copybara-service
copybara-service Bot force-pushed the cl/959298250 branch 3 times, most recently from 82e67de to b52165f Compare September 8, 2026 23:02
`Command` previously relied on `posix_spawn` with `/bin/sh`, the POSIX `env` utility for environment variable modifications, and shell `<` redirection syntax in arguments. These mechanisms are not portable to Windows.

Refactor `Command` to support native Windows process management alongside POSIX:

- Introduce `Command::PlatformContext` to encapsulate platform-specific process handles (`HANDLE` on Windows vs. `pid_t` and `ForkServerProps` on POSIX).

- Implement Windows process creation, environment block construction (`Options::env_diff`), and standard stream redirection in `Command::ExecuteAsync()` using `CreateProcessA`.

- Add `Options::stdin_file_path` to handle input redirection directly rather than appending `"<"` to command arguments, and update `SymbolTable` to use it.

- Escape command-line arguments, environment variables, and file paths in `Command::ToString()` on both POSIX (`ShellEscape`) and Windows.

- Update `command_test_helper` and `command_test` to verify arguments, environment variables, standard input, and signals portably without relying on `bash`, and enable `centipede:command_test` on Windows CI.

- Update `GetDataDependencyFilepath` to return executable path suffixed with `.exe` under Windows.

PiperOrigin-RevId: 959298250
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