zed
zed copied to clipboard
Unable to evaluate "pwd" in task args
trafficstars
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
- Create task with definition like:
{
"label": "Run te.py",
"command": "python3",
"args": ["$(pwd)/te.py"]
}
- run using command
task: spawn - Got en error
can't open file '//$(pwd)/te.py': [Errno 2] No such file or directory
Environment
Zed: v0.124.8 (Zed) OS: macOS 13.5.2 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.
I can see error in logs like below:
2024-03-01T12:05:28+01:00 [ERROR] crates/tasks_ui/src/lib.rs:38: Cannot determine task cwd for multiple worktrees
Hey,
Thanks for reporting this issue.
Currently we spawn static tasks (== tasks from tasks.json) without going through shell, which means that $(pwd) is interpreted literally.
To work around that, you can spawn shell first:
{
"label": "Run te.py",
"command": "bash",
"args": ["-c", "python3 $(pwd)/te.py"]
}
For what it's worth, it seems like we'll have to spawn static tasks through shell, so your original example should work in the near future.