wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.72k stars 793 forks source link

failed to connect to Socket("gui-sock-...") #4456

Open GrzegorzKozub opened 1 year ago

GrzegorzKozub commented 1 year ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20231004-113117-11dec45f

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I would like to be able to control a running GUI instance with the default local domain from wezterm cli on Windows. I first launch wezterm-gui.exe. This creates a GUI window for me as expected. Then I execute wezterm cli list for examplefrom apwsh.exeorcmd.exe` instance running outside of WezTerm. This, after some 5 seconds, gives me an error:

ERROR  wezterm > failed to connect to Socket("gui-sock-14616"): connecting to gui-sock-14616; terminating

Providing --class param for the original GUI launch and the wezterm cli call does not help. I feel like the GUI instance has been found though.

Interestingly, when I call wezterm cli list from the shell running inside WezTerm, the result is as expected.

image

Used the release build and nightly build.

What am I missing here?

To Reproduce

No response

Configuration

no config

Expected Behavior

As described in Targeting the correct instance, a running GUI instance is found and used for any of the wezterm cli commands.

Logs

No response

Anything else?

No response

RekiDunois commented 11 months ago

same issue here in mac os, run wezterm cli spawn return as below:

23:04:55.593  ERROR  wezterm > failed to connect to Socket("/Users/rekidunois/.local/share/wezterm/gui-sock-10494"): connecting to /Users/rekidunois/.local/share/wezterm/gui-sock-10494; terminating
smorks commented 2 months ago

i was able to get wezterm cli list to work in a separate terminal window in Windows by checking what the WEZTERM_UNIX_SOCKET env var is set to in the wezterm terminal, then manually setting the env var that in the other terminal window, then wezterm cli list outputs correctly.

so i'm wondering if this isn't actually a bug, but expected behavior when that environment var isn't set.

there's some further discussion here: #1208, that is specific to Mac but seems relevant to this as well.

edit: it is strange, however, that it does reference the correct filename of the socket in the error. if i have some time i might dive into the code to see if i can figure out what's causing this.

edit2: running wezterm cli list from the directory where the gui-sock-* file exists appears to work as expected too. so for some reason it looks like it's not looking in the correct directory?