Open yuzisee opened 3 weeks ago
related issue:https://github.com/zed-industries/zed/issues/20060
related issue:#20060
Did you mean #19873
Okay, playing around I was able to reproduce with a simpler set of steps today:
Nothing happens (it doesn't run the task)
Zed.log is:
2024-11-01T07:43:38.852218-07:00 [INFO] ========== starting zed ==========
2024-11-01T07:43:38.866098-07:00 [INFO] Opening main db
2024-11-01T07:43:38.870912-07:00 [INFO] Opening main db
2024-11-01T07:43:38.889877-07:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-11-01T07:43:38.925792-07:00 [INFO] set environment variables from shell:/bin/zsh, path:/usr/local/bin:/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:/usr/local/MacGPG2/bin:/Users/joseph/.cargo/bin
2024-11-01T07:43:39.272779-07:00 [INFO] no tokio runtime found, creating one for Reqwest...
2024-11-01T07:43:39.353809-07:00 [INFO] initializing context server client
2024-11-01T07:43:39.356689-07:00 [INFO] Registering built-in prompt template: content_prompt
2024-11-01T07:43:39.358787-07:00 [INFO] Registering built-in prompt template: edit_workflow
2024-11-01T07:43:39.359061-07:00 [INFO] Registering built-in prompt template: project_slash_command
2024-11-01T07:43:39.359142-07:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt
2024-11-01T07:43:39.359784-07:00 [INFO] No prompt template overrides directory found at /Users/joseph/.config/zed/prompt_overrides. Using built-in prompts.
2024-11-01T07:43:39.37225-07:00 [INFO] extensions updated. loading 2, reloading 0, unloading 0
2024-11-01T07:43:39.464947-07:00 [INFO] Opening main db
2024-11-01T07:43:39.550821-07:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-11-01T07:43:39.563096-07:00 [INFO] Opening main db
2024-11-01T07:43:39.572546-07:00 [INFO] Opening main db
2024-11-01T07:43:39.617754-07:00 [INFO] using project environment variables shell launched in "/Users/joseph/Documents/startx-web". PATH="/usr/local/bin:/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:/usr/local/MacGPG2/bin:/Users/joseph/.cargo/bin"
2024-11-01T07:43:39.635662-07:00 [INFO] open paths ["/Users/joseph/.config/zed/tasks.json"]
2024-11-01T07:43:39.645291-07:00 [INFO] attempting to start language server "json-language-server", path: "/Users/joseph/.config/zed/tasks.json", id: 1
2024-11-01T07:43:39.648267-07:00 [INFO] fetching latest version of language server "json-language-server"
2024-11-01T07:43:39.649109-07:00 [INFO] Node runtime install_if_needed
2024-11-01T07:43:39.85962-07:00 [INFO] attempting to start language server "solargraph", path: "/Users/joseph/Documents/startx-web", id: 2
2024-11-01T07:43:39.867162-07:00 [INFO] starting language server process. binary path: "/usr/local/bin/solargraph", working directory: "/Users/joseph/Documents/startx-web", args: ["stdio"]
2024-11-01T07:43:40.598665-07:00 [INFO] downloading language server "json-language-server"
2024-11-01T07:43:40.599119-07:00 [INFO] Node runtime install_if_needed
2024-11-01T07:43:40.693241-07:00 [INFO] Node runtime install_if_needed
2024-11-01T07:43:40.778425-07:00 [INFO] using project environment for language server LanguageServerName("json-language-server")
2024-11-01T07:43:40.778564-07:00 [INFO] starting language server process. binary path: "/Users/joseph/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/Users/joseph/.config/zed", args: ["/Users/joseph/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-11-01T07:43:54.956345-07:00 [ERROR] Working directory: /Users/joseph/.config/zed/tasks.json Shell command: `/bin/zsh -i -c git remote update origin --prune`, IOError: Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Caused by:
Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Okay, I can reproduce this 100% of the time:
zed: open tasks
task: spawn
[ERROR] Working directory: /Users/joseph/.config/zed/tasks.json Shell command: `/bin/zsh -i -c git remote update origin --prune`, IOError: Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Caused by:
Failed to spawn command '/bin/zsh': Not a directory (os error 20)
task: spawn
It works now! The task runs just fine.
Your editor now has two files open:
task: spawn
Fails again:
[ERROR] Working directory: /Users/joseph/.config/zed/tasks.json Shell command: `/bin/zsh -i -c git remote update origin --prune`, IOError: Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Caused by:
Failed to spawn command '/bin/zsh': Not a directory (os error 20)
task: spawn
It works now! The task runs just fine.
Note: I can reproduce this also with ~/.config/zed/keymap.json
task: spawn
[ERROR] Working directory: /Users/joseph/.config/zed/keymap.json Shell command: `/bin/zsh -i -c git remote update origin --prune`, IOError: Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Caused by:
Failed to spawn command '/bin/zsh': Not a directory (os error 20)
On an unrelated (but maybe part of the problem?) set of steps:
task: spawn
EXPECTED BEHAVIOR: The list of tasks that you created in ~/.config/zed/tasks.json appears for you to choose from
ACTUAL BEHAVIOR: (only the recent tasks appear, but none of your actual tasks from ~/.config/zed/tasks.json itself are in the list)
HOWEVER…
This way DOES work
While trying even more combinations to reproduce the issue, I was able to get it to crash once
Attaching the crashlog in case it helps point to something useful zed-2024-11-01-083434.ips.zip
and, symbolicating... (please wait)
+ symbolicate /Users/joseph/Library/Logs/DiagnosticReports/zed-2024-11-01-083434.ips target/dsyms/stable/Zed-0.159.7-aarch64-apple-darwin.dwarf
Segmentation fault: 11 on thread 21987612 (main com.apple.main-thread)
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..boxed..Box$LT$dyn$u20$gpui..action..Action$GT$$GT$::h95ebfca00f8d93a0
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$ui..components..context_menu..ContextMenu..action$LT$$RF$str$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$::hf481f255d3c4fadc
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/mem/mod.rs:394: core::mem::size_of_val_raw::he07202fb7909ff16
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/alloc/layout.rs:203: core::alloc::layout::Layout::for_value_raw::h4b2cefa43a7a6e1d
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:1293: _$LT$alloc..boxed..Box$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h54efbd9c818bbbd3
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..Fn$LT$$LP$$RF$gpui..interactive..ClickEvent$C$$RF$mut$u20$gpui..window..WindowContext$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$::h62f14133117aef16
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$$LT$ui..components..button..button_like..ButtonLike$u20$as$u20$gpui..element..RenderOnce$GT$..render..$u7b$$u7b$closure$u7d$$u7d$..$u7b$$u7b$closure$u7d$$u7d$$GT$::h5dc3786076013651
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$gpui..elements..div..Interactivity..on_click$LT$$LT$ui..components..button..button_like..ButtonLike$u20$as$u20$gpui..element..RenderOnce$GT$..render..$u7b$$u7b$closure$u7d$$u7d$..$u7b$$u7b$closure$u7d$$u7d$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$::hc1793fe94135fcdf
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/mem/mod.rs:394: core::mem::size_of_val_raw::h4886e8c0d04b364d
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/alloc/layout.rs:203: core::alloc::layout::Layout::for_value_raw::hf921ba9de1e35b11
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:1293: _$LT$alloc..boxed..Box$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h17b55fe90c718c73
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnOnce$LT$$LP$$RF$mut$u20$gpui..window..WindowContext$C$$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$::h7a94f8749e42af7d
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$$u5b$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnOnce$LT$$LP$$RF$mut$u20$gpui..window..WindowContext$C$$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$u5d$$GT$::h150768b20ed8de77
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/vec/mod.rs:3308: _$LT$alloc..vec..Vec$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h477f591adb468fa4
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..vec..Vec$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnOnce$LT$$LP$$RF$mut$u20$gpui..window..WindowContext$C$$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$$GT$::h67b029a4af3f2671
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/mem/mod.rs:394: core::mem::size_of_val_raw::h281abbf0d8caa749
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/alloc/layout.rs:203: core::alloc::layout::Layout::for_value_raw::h51c1f55ace4c9a32
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:1293: _$LT$alloc..boxed..Box$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::hb2bddb1eecdc1122
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnMut$LT$$LP$$RF$dyn$u20$core..any..Any$C$gpui..window..DispatchPhase$C$$RF$mut$u20$gpui..window..WindowContext$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$::h5a581a7032e5b584
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$core..option..Option$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnMut$LT$$LP$$RF$dyn$u20$core..any..Any$C$gpui..window..DispatchPhase$C$$RF$mut$u20$gpui..window..WindowContext$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$$GT$::h0dff048a021a7763
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$$u5b$core..option..Option$LT$alloc..boxed..Box$LT$dyn$u20$core..ops..function..FnMut$LT$$LP$$RF$dyn$u20$core..any..Any$C$gpui..window..DispatchPhase$C$$RF$mut$u20$gpui..window..WindowContext$RP$$GT$$u2b$Output$u20$$u3d$$u20$$LP$$RP$$GT$$GT$$u5d$$GT$::hbe4654bbb8f558e3
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/vec/mod.rs:2243: alloc::vec::Vec$LT$T$C$A$GT$::clear::hc93e66cfdaa4b77c
crates/gpui/src/window.rs:459: gpui::window::Frame::clear::hb71e411ea7d221e1
crates/gpui/src/window.rs:1455: gpui::window::WindowContext::draw::h05f638391602b105
crates/gpui/src/window.rs:707: gpui::window::Window::new::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h201cb5acccd999f7
crates/gpui/src/app.rs:1452: _$LT$gpui..app..AppContext$u20$as$u20$gpui..Context$GT$::update_window::_$u7b$$u7b$closure$u7d$$u7d$::h84c8b8a2052e7e0d
crates/gpui/src/app.rs:372: gpui::app::AppContext::update::h093a43e6116cca37
crates/gpui/src/app.rs:1443: _$LT$gpui..app..AppContext$u20$as$u20$gpui..Context$GT$::update_window::h7d8b83f8bda78178
crates/gpui/src/app/async_context.rs:91: _$LT$gpui..app..async_context..AsyncAppContext$u20$as$u20$gpui..Context$GT$::update_window::h9e10108fdfe5b2db
crates/gpui/src/window.rs:4800: gpui::window::AnyWindowHandle::update::h8446b700db4dac0f
crates/gpui/src/window.rs:705: gpui::window::Window::new::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h41b8f239abb03f32
crates/util/src/util.rs:327: util::measure::h1ddc31a5ac5ed7a2
crates/gpui/src/window.rs:703: gpui::window::Window::new::_$u7b$$u7b$closure$u7d$$u7d$::h95a9913bcd6bdda5
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/sync/atomic.rs:3423: core::sync::atomic::atomic_compare_exchange_weak::hbde454e38a9e7c90
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/sync/atomic.rs:2642: core::sync::atomic::AtomicU8::compare_exchange_weak::h5abe8efd9e25fc63
/Users/administrator/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parking_lot-0.12.3/src/raw_mutex.rs:69: _$LT$parking_lot..raw_mutex..RawMutex$u20$as$u20$lock_api..mutex..RawMutex$GT$::lock::h8322281815620840
/Users/administrator/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lock_api-0.4.12/src/mutex.rs:223: lock_api::mutex::Mutex$LT$R$C$T$GT$::lock::h102aa74370f8d883
crates/gpui/src/platform/mac/window.rs:1667: gpui::platform::mac::window::step::hc934561119090652
libdispatch.dylib _dispatch_client_callout
libdispatch.dylib _dispatch_continuation_pop
libdispatch.dylib _dispatch_source_latch_and_call
libdispatch.dylib _dispatch_source_invoke
libdispatch.dylib _dispatch_main_queue_drain
libdispatch.dylib _dispatch_main_queue_callback_4CF
CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
CoreFoundation __CFRunLoopRun
CoreFoundation CFRunLoopRunSpecific
HIToolbox RunCurrentEventLoopInMode
HIToolbox ReceiveNextEventCommon
HIToolbox _BlockUntilNextEventMatchingListInModeWithFilter
AppKit _DPSNextEvent
AppKit -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
AppKit -[NSApplication run]
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/sync/atomic.rs:3313: core::sync::atomic::atomic_load::ha193388a972c2363
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/sync/atomic.rs:2421: core::sync::atomic::AtomicUsize::load::h15b754d867e166fa
/Users/administrator/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/macros.rs:54: _$LT$$BP$mut$u20$objc..runtime..Object$u20$as$u20$cocoa_foundation..foundation..NSAutoreleasePool$GT$::drain::register_sel::h72692a8a0d0c3e80
/Users/administrator/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cocoa-foundation-0.2.0/src/foundation.rs:192: _$LT$$BP$mut$u20$objc..runtime..Object$u20$as$u20$cocoa_foundation..foundation..NSAutoreleasePool$GT$::drain::hcd9e6d6c24c4d135
crates/gpui/src/platform/mac/platform.rs:442: _$LT$gpui..platform..mac..platform..MacPlatform$u20$as$u20$gpui..platform..Platform$GT$::run::h929ba7b2ba6dfbb9
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/rc.rs:3455: alloc::rc::RcInnerPtr::dec_strong::h53074ae31c3675b6
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/rc.rs:2219: _$LT$alloc..rc..Rc$LT$T$C$A$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h16d2e6236a43dec6
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ptr/mod.rs:542: core::ptr::drop_in_place$LT$alloc..rc..Rc$LT$dyn$u20$gpui..platform..Platform$GT$$GT$::haa9e5d90756a688f
crates/gpui/src/app.rs:165: gpui::app::App::run::hce5124800e7ea217
crates/zed/src/main.rs:252: zed::main::hf6f7718e78f7d012
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:162: std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::heb7e70f21c86e238
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1433: core::result::Result$LT$T$C$E$GT$::unwrap_or::hf4ab4d10c9f1b6dd
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141: std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::hf216622dc2c733e3
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557: std::panicking::try::do_call::haa691957db1dd55f
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521: std::panicking::try::ha0c1a49b9fabc98e
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350: std::panic::catch_unwind::h68ad032c646bb0ab
/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141: std::rt::lang_start_internal::hdd117cb81a316264
main (in Zed-0.159.7-aarch64-apple-darwin.dwarf) + 52
dyld start
I can reproduce. Spawning a task when the current buffer is outside of a project (e.g. settings.json or tasks.json) will incorrectly use the current filename as the cwd.
2024-11-04T19:39:25.118049-05:00 [ERROR] Working directory: /Users/peter/.config/zed/tasks.json Shell command: `/bin/zsh -i -c lazygit`, IOError: Failed to spawn command '/bin/zsh': Not a directory (os error 20)
Check for existing issues
Describe the bug / provide steps to reproduce it
Configure:
and
The task runs, just as expected. No problems
The task runs, just as expected. No problems
The task runs, just as expected. No problems
EXPECTED BEHAVIOR = The task runs, just as expected. No problems
ACTUAL BEHAVIOR = Sometimes this does work, but sometimes it fails. Once it fails, it will subsequently always fail. You know that it's trying because (if your cursor is currently in the editor) you can see the focus DOES move over to an existing open terminal pane (only if there is an existing terminal pane already open -- it won't open a new terminal no matter what), but in any case still no command is run. If there is no terminal pane open, basically nothing appears to happen at all.
I am watching
~/Library/Logs/Zed/Zed.log
in a separate window the entire time. Whenever it fails, it printsZed.log:
Notice the section that says
Working directory: /Users/joseph/.config/zed/tasks.json
Why is it using
tasks.json
(a file) as the working directory? As you can see in my tasks.json above, I did not set "cwd" so there is no reason for it to look anywhere specific.Environment
Zed: v0.159.7 (Zed) OS: macOS 14.5.0 Memory: 8 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