tasks: relative 'cwd' paths break commands
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Specifying a relative path as cwd in a task causes the command to not execute and an error is seen in the log.
Specifying a full path does work as expected.
Environment
Zed: v0.133.2 (Zed Preview)
OS: macOS 14.5.0
Memory: 8 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
Screen recording:
https://github.com/zed-industries/zed/assets/8061077/29bf217d-ccfd-4b8b-91cc-17cb36163829
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
2024-04-25T18:48:34+02:00 [ERROR] crates/terminal_view/src/terminal_panel.rs:510: Working directory: src Shell command: `/bin/zsh -i -c echo test`, IOError: Failed to spawn command '/bin/zsh': No such file or directory (os error 2)
Caused by:
Failed to spawn command '/bin/zsh': No such file or directory (os error 2)
Bumping this. Having same issue with same error. I'm not able to run specs in another directory in my workspace.
I have a monorepo, with a backend folder where my Rails app lives. The workaround I'm using is to just cd into the directory.
[
{
"label": "rspec $ZED_FILENAME:$ZED_ROW",
"command": "cd backend; bundle exec rspec test",
"args": ["\"$ZED_FILE:$ZED_ROW\""],
"tags": ["ruby-test"]
}
]
It works, but not ideal.
I think I'm seeing this behaviour without any relative paths being involved. In my case, I have a task as follows:
{
"label": "Cargo Check",
"command": "cargo check",
"args": ["--workspace", "--all-targets"],
"shell": "system",
"use_new_terminal": true,
"allow_concurrent_runs": false,
"reveal": "no_focus",
"hide": "never"
}
Running the task should use my default shell which is zsh. Zed detects that but tries to run /bin/zsh which does not exist. zsh is at /usr/bin/zsh which is in PATH and returned – correctly – by command -v zsh.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!
If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open.
Relative paths for cwd flat-out don't appear to work. At this point, I'm not sure if this is even supposed to work at all.
Setting the command to pwd, and cwd to be a relative path, the output is simply the default path:
Setting an absolute path does work:
I found a workaround:
[
{
"label": "Run",
"command": "make -j",
"cwd": "${ZED_WORKTREE_ROOT}/build/"
}
]
Using ZED_WORKTREE_ROOT seems Okay, a little tedious but at least portable.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!
We still see ZED_WORKTREE_ROOT everywhere in docs...