Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Alacritty crashed and froze when working_directory is invalid #7615

Open
Karmenzind opened this issue Jan 12, 2024 · 10 comments
Open

Comments

@Karmenzind
Copy link

Hi,
I tried to set working_directory = "$env:HOMEPATH". Then the window crashed and froze like this. Have to forcely close it with Task Manager.

image

Navidating to the default path and prompting an error message might be better.

BTW, is there any way to use ~ as the working_directory on Windows without hardcoding the whole path?

Env

OS: Windows 11
Version: alacritty 0.13.0 (78fa4d6)

Logs

alacritty --print-events:

 pwsh  [0.128743900s] [INFO ] [alacritty] Using WGL
[0.149598900s] [INFO ] [alacritty] Running on AMD Radeon RX 6500 XT
[0.149762200s] [INFO ] [alacritty] OpenGL version 3.3.14800 Core Profile Context 22.5.2 30.0.21017.1000, shader_version 4.60
[0.149912700s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.211883500s] [INFO ] [alacritty] Cell size: 13 x 30
[0.212084800s] [INFO ] [alacritty] Padding: 3 x 3
[0.212224900s] [INFO ] [alacritty] Width: 800, Height: 600
[0.245618900s] [INFO ] [alacritty] PTY dimensions: 19 x 61
[0.246553800s] [INFO ] [alacritty_terminal] Using Windows API for pseudoconsole
panicked at alacritty_terminal\src\tty\windows\conpty.rs:235:5:
Unable to spawn shell: 目录名称无效。 (os error 267)
@Karmenzind Karmenzind changed the title [windows] alacritty crashed and froze when working_directory is invalid [Windows] Alacritty crashed and froze when working_directory is invalid Jan 12, 2024
@chrisduerr
Copy link
Member

How are you setting the working directory?

@Karmenzind
Copy link
Author

On my Win11 a minimal alacritty.toml can reproduce this issue:

working_directory = "$env:HOMEPATH"

I also tried working_directory = "~".

My real configuration is like:

  • Main alacritty.toml:
import = [
  "~/.alacritty_extra.toml",
]
live_config_reload = true

# other stuff
  • .alacritty_extra.toml:
shell = "pwsh"
working_directory = "C:/Users/XXX"

@kchibisov
Copy link
Member

we don't support env variables in config. ~ is also non-existent directory, it's a shell alias.

Setting non-existing directory will prevent alacritty from starting.

@Karmenzind
Copy link
Author

Karmenzind commented Jan 13, 2024

@kchibisov
But ~ works in import = ['~/xxx.toml'] which might be confusing.
And a friendly error message (like below) is more reasonable than crashing.
image

@kchibisov
Copy link
Member

@Karmenzind but the import docs explicitly say that it works there.

@Karmenzind
Copy link
Author

@Karmenzind but the import docs explicitly say that it works there.

Fine. I also don't think the path processing is a bug.
The real problem is the program window gets stuck on Windows and sticks on top and can only be killed with Stop-Process.
I notice that on Linux it will flash and disappear, which is acceptable.

@chrisduerr
Copy link
Member

Does the same behavior happen when you use an invalid shell?

@Karmenzind
Copy link
Author

Yes. shell = 'xxx' led to the same result. @chrisduerr

@chrisduerr
Copy link
Member

Seems like things just don't shut down on any error then? I'd assume it works with closing the shell properly?

@kchibisov do you know if winit does anything odd on Windows for error handling/panic hooks?

@lesleyrs
Copy link

[shell]
program = "pwsh"
args = ["-WorkingDirectory ~",]

This allows you to use ~ for home directory on Windows, but it requires the newer pwsh instead of powershell https://github.com/PowerShell/PowerShell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants