zed/crates/dev_container
Rabindra Kumar Meher 864ff0ba3f
Run string-form dev container lifecycle commands in /bin/sh -c (#60792)
# Objective

Fixes #60228.

String-form dev container lifecycle commands are currently executed by
splitting the command on spaces and running the first token directly.
This means shell features such as variable expansion, pipes,
redirection, and command chaining do not work.

According to the Dev Container specification, string-form lifecycle
commands should run through `/bin/sh -c`, while array-form commands
should continue to execute directly.

## Solution

- Added `LifecycleScript::shell_command()` to wrap string-form commands
in `/bin/sh -c`.
- Updated string deserialization to use `shell_command()` instead of
splitting on spaces.
- Kept array-form commands unchanged.

## Testing

- Ran `cargo test -p dev_container` (107 tests passed).
- Added a regression test to verify string-form commands run through
`/bin/sh -c`.
- Added a regression test to verify array-form commands still execute
directly.
- Updated the existing deserialization tests to match the expected
behavior.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed string-form dev container lifecycle commands so they execute
through `/bin/sh -c` as required by the Dev Container specification.
2026-07-31 08:53:21 +00:00
..
src Run string-form dev container lifecycle commands in /bin/sh -c (#60792) 2026-07-31 08:53:21 +00:00
Cargo.toml Support local devcontainer features (#55225) 2026-05-26 07:13:00 +00:00
LICENSE-GPL Devcontainer setup modal (#47021) 2026-01-16 15:20:48 -08:00