Skip to content

Ensure workdir exists before running a command #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025

Conversation

dobrac
Copy link
Contributor

@dobrac dobrac commented Jul 30, 2025

Ensure the working directory exists before executing any command. Running commands in a non-existent directory can cause unpredictable behavior, including silent failures, incorrect error messages, or commands executing in unexpected locations (such as the parent directory or system root).

This solution fails immediately when the directory doesn't exist to communicate the reason to the user. This a difference from how Dockerfile behaves, but keeps the behavior clear as it's a bit unexpected situation.

Copy link

linear bot commented Jul 30, 2025

@dobrac dobrac self-assigned this Jul 30, 2025
@dobrac dobrac added the bug Something isn't working label Jul 30, 2025
@dobrac dobrac marked this pull request as ready for review July 30, 2025 14:44
@dobrac dobrac force-pushed the when-workdir-is-deleted-recreate-it-e2b-2787 branch from 65a2ed0 to 50dfdfe Compare July 30, 2025 14:46
jakubno
jakubno previously approved these changes Jul 30, 2025
@dobrac dobrac marked this pull request as draft July 30, 2025 16:40
@dobrac dobrac force-pushed the when-workdir-is-deleted-recreate-it-e2b-2787 branch from 50dfdfe to c4debff Compare July 30, 2025 17:03
@dobrac dobrac requested a review from jakubno July 30, 2025 17:05
@dobrac dobrac dismissed jakubno’s stale review July 30, 2025 17:05

changed the approach from creating the dir to erroring out fast

@dobrac dobrac force-pushed the when-workdir-is-deleted-recreate-it-e2b-2787 branch from c4debff to 31b1ca2 Compare July 30, 2025 17:05
@dobrac dobrac marked this pull request as ready for review July 30, 2025 17:05
@dobrac dobrac force-pushed the when-workdir-is-deleted-recreate-it-e2b-2787 branch from 31b1ca2 to 9b38570 Compare July 30, 2025 17:07
@dobrac dobrac merged commit 8eb6711 into main Jul 31, 2025
25 checks passed
@dobrac dobrac deleted the when-workdir-is-deleted-recreate-it-e2b-2787 branch July 31, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants