Skip to content

Run string-form dev container lifecycle commands in /bin/sh -c#60792

Open
rabindra789 wants to merge 3 commits into
zed-industries:mainfrom
rabindra789:fix/devcontainer-string-lifecycle-command-shell
Open

Run string-form dev container lifecycle commands in /bin/sh -c#60792
rabindra789 wants to merge 3 commits into
zed-industries:mainfrom
rabindra789:fix/devcontainer-string-lifecycle-command-shell

Conversation

@rabindra789

Copy link
Copy Markdown

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

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards
  • Tests cover the new behavior
  • 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.

@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @rabindra789 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jul 11, 2026
@rabindra789

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @rabindra789 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @rabindra789 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@rabindra789

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 11, 2026
@cla-bot

cla-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title fix: Run string-form dev container lifecycle commands in /bin/sh -c Run string-form dev container lifecycle commands in /bin/sh -c Jul 11, 2026
@DerekParks

Copy link
Copy Markdown

@rabindra789
Thanks for putting this up!

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

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev containers: string-form lifecycle commands are not run in a shell

2 participants