# Run string-form dev container lifecycle commands in /bin/sh \-c \(\#60792\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/864ff0ba3fb1bbb0c8074e63156ade8c5f835347)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 864ff0ba3fb1bbb0c8074e63156ade8c5f835347

Requested commit: 864ff0ba3fb1bbb0c8074e63156ade8c5f835347

Commit: 864ff0ba3fb1bbb0c8074e63156ade8c5f835347

Tree: 1d5c955041c0c889a2c99d67db08ab518f581a59

Author: Rabindra Kumar Meher

Committer: GitHub

## Message

```
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.
```

## Parents

- [58a3c0fa0e9e32d1d2e554b56e8da969fd1d3621](https://git.cafe/gitcafe/zed/commit/58a3c0fa0e9e32d1d2e554b56e8da969fd1d3621?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/864ff0ba3fb1bbb0c8074e63156ade8c5f835347?format=markdown)
