zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.07k stars 3.07k forks source link

Spawning tasks just spawns a terminal is shell is fish #20588

Open theherk opened 2 days ago

theherk commented 2 days ago

Check for existing issues

Describe the bug / provide steps to reproduce it

This used to work for me, but I haven't used tasks in a while. Not clear what the cause is. Consider two tasks:

[
  {
    "label": "htop-fish",
    "command": "htop",
    "working_directory": "${workspace_root}",
    "use_new_terminal": true,
    "allow_concurrent_runs": false,
    "shell": {
      "program": "fish"
    }
  },
  {
    "label": "htop-bash",
    "command": "htop",
    "working_directory": "${workspace_root}",
    "use_new_terminal": true,
    "allow_concurrent_runs": false,
    "shell": {
      "program": "bash"
    }
  },
]

htop-bash works as expected, but htop-fish just starts a shell, then upon typing exit, I get:

ᐅ exit

⏵ Task `htop-fish` finished successfully
⏵ Command: fish -i -c 'htop'

Environment

Zed: v0.160.7 (Zed) OS: macOS 15.1.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log ``` 2024-11-13T13:39:43.150466+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:43.161329+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:43.175071+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:43.175172+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:43.175227+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:43.177402+01:00 [ERROR] oneshot canceled 2024-11-13T13:39:48.645523+01:00 [INFO] ========== starting zed ========== 2024-11-13T13:39:48.647642+01:00 [INFO] Opening main db 2024-11-13T13:39:48.651386+01:00 [INFO] Opening main db 2024-11-13T13:39:48.669333+01:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git") 2024-11-13T13:39:48.97157+01:00 [INFO] no tokio runtime found, creating one for Reqwest... 2024-11-13T13:39:48.992732+01:00 [ERROR] theme not found: Catppuccin Mocha 2024-11-13T13:39:48.99296+01:00 [INFO] initializing context server client 2024-11-13T13:39:48.993067+01:00 [INFO] Registering built-in prompt template: content_prompt 2024-11-13T13:39:48.993387+01:00 [INFO] Registering built-in prompt template: edit_workflow 2024-11-13T13:39:48.993538+01:00 [INFO] Registering built-in prompt template: project_slash_command 2024-11-13T13:39:48.993697+01:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt 2024-11-13T13:39:48.993965+01:00 [INFO] No prompt template overrides directory found at /Users/h4s/.config/zed/prompt_overrides. Using built-in prompts. 2024-11-13T13:39:49.013667+01:00 [INFO] extensions updated. loading 18, reloading 0, unloading 0 2024-11-13T13:39:49.051578+01:00 [INFO] Opening main db 2024-11-13T13:39:49.071791+01:00 [ERROR] theme not found: Catppuccin Mocha 2024-11-13T13:39:49.07291+01:00 [ERROR] theme not found: Catppuccin Mocha 2024-11-13T13:39:49.08272+01:00 [INFO] building git repository, `.git` path in the worktree: ".git" 2024-11-13T13:39:49.106978+01:00 [ERROR] error processing "/Users/h4s/commons/bin/gproxy": No such file or directory (os error 2) 2024-11-13T13:39:49.108687+01:00 [ERROR] theme not found: Catppuccin Mocha 2024-11-13T13:39:49.109079+01:00 [INFO] set status on client 0: Authenticating 2024-11-13T13:39:49.109521+01:00 [INFO] Opening main db 2024-11-13T13:39:49.113035+01:00 [INFO] open paths ["/Users/h4s/.config/zed/tasks.json"] 2024-11-13T13:39:49.113989+01:00 [INFO] Opening main db 2024-11-13T13:39:49.121228+01:00 [ERROR] Working directory: /Users/h4s Shell command: `fish`, IOError: Failed to spawn command 'fish': No such file or directory (os error 2) Caused by: Failed to spawn command 'fish': No such file or directory (os error 2) 2024-11-13T13:39:49.121385+01:00 [INFO] set status on client 99601: Connecting 2024-11-13T13:39:49.122671+01:00 [ERROR] theme not found: Catppuccin Mocha 2024-11-13T13:39:49.13598+01:00 [INFO] attempting to start language server "json-language-server", path: "/Users/h4s/.config/zed/tasks.json", id: 1 2024-11-13T13:39:49.136128+01:00 [INFO] Initializing default prettier with plugins {} 2024-11-13T13:39:49.136309+01:00 [INFO] Initializing default prettier with plugins {} 2024-11-13T13:39:49.136744+01:00 [INFO] fetching latest version of language server "json-language-server" 2024-11-13T13:39:49.137039+01:00 [INFO] Node runtime install_if_needed 2024-11-13T13:39:49.145783+01:00 [ERROR] Working directory: /Users/h4s Shell command: `fish`, IOError: Failed to spawn command 'fish': No such file or directory (os error 2) Caused by: Failed to spawn command 'fish': No such file or directory (os error 2) 2024-11-13T13:39:49.149113+01:00 [WARN] Theme "macOS Classic Light" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead. 2024-11-13T13:39:49.149211+01:00 [WARN] Theme "macOS Classic Dark" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead. 2024-11-13T13:39:49.149348+01:00 [WARN] Theme "macOS Classic Dark2" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead. 2024-11-13T13:39:49.186416+01:00 [INFO] Initializing default prettier with plugins {} 2024-11-13T13:39:49.188293+01:00 [INFO] Initializing default prettier with plugins {} 2024-11-13T13:39:49.491992+01:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc 2024-11-13T13:39:49.638505+01:00 [INFO] Node runtime install_if_needed 2024-11-13T13:39:49.748788+01:00 [INFO] starting language server process. binary path: "/Users/h4s/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/", args: ["/Users/h4s/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"] 2024-11-13T13:39:50.056926+01:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-11-13T12:39:50.054Z] Agent service starting", "metadataStr": "[DEBUG] [agent] [2024-11-13T12:39:50.054Z]", "extra": [ "Agent service starting" ] } 2024-11-13T13:39:50.05809+01:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability: { "registrations": [ { "id": "41662750-62ae-4736-9d36-840429041b59", "method": "workspace/didChangeWorkspaceFolders", "registerOptions": {} } ] } 2024-11-13T13:39:50.059515+01:00 [INFO] Initializing default prettier with plugins {} 2024-11-13T13:39:50.059595+01:00 [INFO] attempting to start language server "lua-language-server", path: "/Users/h4s/commons", id: 2 2024-11-13T13:39:50.085916+01:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-11-13T12:39:50.062Z] Telemetry initialized", "metadataStr": "[DEBUG] [agent] [2024-11-13T12:39:50.062Z]", "extra": [ "Telemetry initialized" ] } 2024-11-13T13:39:50.094474+01:00 [INFO] add connection to peer 2024-11-13T13:39:50.094541+01:00 [INFO] add_connection; 2024-11-13T13:39:50.094596+01:00 [INFO] waiting for server hello 2024-11-13T13:39:50.102051+01:00 [INFO] got server hello 2024-11-13T13:39:50.102119+01:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 606, id: 11192864 }) 2024-11-13T13:39:50.102202+01:00 [INFO] set status on client 99601: Connected { peer_id: PeerId { owner_id: 606, id: 11192864 }, connection_id: ConnectionId { owner_id: 0, id: 0 } } 2024-11-13T13:39:50.112089+01:00 [INFO] set environment variables from shell:/opt/homebrew/bin/fish, path:/Users/h4s/.jenv/shims:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.4/shims:/Users/h4s/.pyenv/shims:/opt/homebrew/bin:/Users/h4s/.cargo/bin:/Users/h4s/projects/go/bin:/Users/h4s/.volta/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/Users/h4s/.emacs.d/bin:/Users/h4s/.local/bin:/Users/h4s/bin:/usr/local/bin:/usr/local/go/bin:/opt/homebrew/opt/fzf/bin:/opt/homebrew/sbin:/Users/h4s/.jenv/shims:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin 2024-11-13T13:39:50.929408+01:00 [ERROR] Os { code: 2, kind: NotFound, message: "No such file or directory" } 2024-11-13T13:39:50.929514+01:00 [INFO] using project environment variables shell launched in "/Users/h4s/.config/zed/tasks.json". PATH="/Users/h4s/.jenv/shims:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.4/shims:/Users/h4s/.pyenv/shims:/opt/homebrew/bin:/Users/h4s/.cargo/bin:/Users/h4s/projects/go/bin:/Users/h4s/.volta/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/Users/h4s/.emacs.d/bin:/Users/h4s/.local/bin:/Users/h4s/bin:/usr/local/bin:/usr/local/go/bin:/opt/homebrew/opt/fzf/bin:/opt/homebrew/sbin:/Users/h4s/.jenv/shims:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin" 2024-11-13T13:39:50.929759+01:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/lua-language-server", working directory: "/Users/h4s/commons", args: [] 2024-11-13T13:39:51.366477+01:00 [INFO] Language server with id 2 sent unhandled notification $/hello: [ "world" ] 2024-11-13T13:39:51.904635+01:00 [WARN] unhandled capability registration: Registration { id: "workspace/didChangeConfiguration", method: "workspace/didChangeConfiguration", register_options: None } 2024-11-13T13:39:51.984346+01:00 [INFO] downloading language server "json-language-server" 2024-11-13T13:39:52.528429+01:00 [INFO] using project environment for language server LanguageServerName("json-language-server") 2024-11-13T13:39:52.528544+01:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/Users/h4s/.config/zed", args: ["/Users/h4s/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"] 2024-11-13T13:39:52.95074+01:00 [INFO] skipping numeric progress token 2 2024-11-13T13:39:53.003846+01:00 [INFO] skipping numeric progress token 2 2024-11-13T13:39:53.13058+01:00 [INFO] skipping numeric progress token 2 2024-11-13T13:39:53.130684+01:00 [INFO] skipping numeric progress token 2 2024-11-13T13:39:54.180399+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.2384+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.31851+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.392286+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.445955+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.499635+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.553194+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.60876+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.66001+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.712161+01:00 [INFO] skipping numeric progress token 121 2024-11-13T13:39:54.727006+01:00 [INFO] skipping numeric progress token 121 ```
notpeter commented 2 days ago
  1. The correct variable is ${ZED_WORKTREE_ROOT} not ${workspace_root}
  2. I was not able to reproduce this. I ran into a different issue which is fixed by:

If you run fish -i -c 'htop' from a Zed terminal does it behave as expected?

The only thing I can think of is that fish isn't actually a path/symlink in your path but an alias maybe? Can you run command -v fish to confirm it returns /opt/homebrew/bin/fish?

theherk commented 2 days ago

Yes fish -i -c 'htop' works as expected. Sorry, I meant to include that detail. And

ᐅ command -v fish
/opt/homebrew/bin/fish