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
39.57k stars 2.07k forks source link

Windows - Zed crashes on terminal open unless config is fixed #11645

Open arihant2math opened 1 month ago

arihant2math commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When opening the terminal (by clicking on the button on the toolbar) on windows, the entire application crashes unless the following is set in the zed settings:

"terminal": {
    "shell": {
        "program": "pwsh"
    }
  }

where the program is either pwsh or cmd or any other installed shell.

Environment

Zed: v0.136.0 (Zed Dev 0c2d71f1ace6c5ca43e00179898ff9c8a982d9ae) OS: Windows 10.0.22635 Memory: 15.9 GiB Architecture: x86_64

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

The logs simply end with

2024-05-09T21:12:50-07:00 [INFO] Using Windows API for pseudoconsole

(The log message is from alacritty)

Zed.log

arihant2math commented 1 month ago

It seems like this line is unix only.

a-usr commented 1 month ago

It works for me (windows 11 Build 22631.3447) When clicking on the terminal with the default configuration it opens cmd.exe for a shell. I find it quite odd that there is no panic whatsoever. Are you building under native windows or wsl? are you sure zed isn't still running? Is cmd.exe working correctly? Try disabling any antivirus application before starting the terminal in zed.

arihant2math commented 1 month ago

It works for me (windows 11 Build 22631.3447) When clicking on the terminal with the default configuration it opens cmd.exe for a shell.

Issues are likely not going to be reproducible for all users, especially because this is windows.

I find it quite odd that there is no panic whatsoever. Are you building under native windows or wsl?

I doubt wsl is even supported, I am in fact building under natively.

are you sure zed isn't still running? Is cmd.exe working correctly?

yes and yes

Try disabling any antivirus application before starting the terminal in zed.

uh ... I don't see how this would help?

  1. Terminals work out of the box in basically every other ide/text editor on my computer (JetBrains, VSC, etc.) so this isn't some sort of issue with my computer.

  2. This is a silent panic that is occurring because alacrity is mis-configured in some way (to the best of my knowledge). Part of me suspects that zed is feeding in a ~ to cmd.exe (as part of the working directory or some other configuration), which leads to the crash or zed could be trying to spawn a sh shell or similar and crashing because of that.

  3. I don't have antivirus installed

a-usr commented 1 month ago
  1. This is a silent panic that is occurring because alacrity is mis-configured in some way (to the best of my knowledge). Part of me suspects that zed is feeding in a ~ to cmd.exe (as part of the working directory or some other configuration), which leads to the crash or zed could be trying to spawn a sh shell or similar and crashing because of that.

Good thinking, but can you prove that? And what about the return code when zed exits?

arihant2math commented 1 month ago
  1. This is a silent panic that is occurring because alacrity is mis-configured in some way (to the best of my knowledge). Part of me suspects that zed is feeding in a ~ to cmd.exe (as part of the working directory or some other configuration), which leads to the crash or zed could be trying to spawn a sh shell or similar and crashing because of that.

Good thinking, but can you prove that? And what about the return code when zed exits?

Well it's silent, I can't really prove it any more than the fact alacrity had a similar issue: https://github.com/alacritty/alacritty/issues/7615

a-usr commented 1 month ago

To be honest to me this feels like something in your environment is forcefully terminating zed for some reason. Are you on your home device? Or some sort of corporate managed device?

arihant2math commented 1 month ago

To be honest to me this feels like something in your environment is forcefully terminating zed for some reason. Are you on your home device? Or some sort of corporate managed device?

The thing is, it worked after changing that setting. It is a home device.

a-usr commented 1 month ago

In that case i cant help you... I am very sorry, but i have no idea what could be causing this, and the fact that i cant replicate this issue on neither of my two devices doesnt help it...