win32yank: win32yank crashes when pasting from vim in WSL

win32yank cannot consistently paste text, if the text was copied using vim or neovim in WSL. To reproduce, open vim in WSL. Type a line such as “test”, then use "*yy to yank the line into the system clipboard. In another window, execute:

win32yank.exe -o

Running the command repeatedly, half the time the line it pasted. The other half of the time, the following error is shown:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: WinAPI Error(6)', src\libcore\result.rs:859
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: BaseThreadInitThunk

The problem occurs even when invoking win32yank from CMD.exe.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 5
  • Comments: 28 (2 by maintainers)

Most upvoted comments

So although I always used to have win32yank installed on the Linux side and it worked fine, I did have the delay problem lately with latest WSL.

However, removing it from the Linux side and just installing it on the windows side with Scoop now works fine without delay for me. Basically the Linux side is just pointing to the win32yank installed on Windows like so: image

Seems to work fine so far.

I’m WSL2, Ubuntu 20.04, NVIM v0.5.0-563-ge628a05b5, recent win32yank version (how do I check the version)?

And I at about once every 2 hours while coding get:

clipboard: error invoking win32yank.exe: thread 'main' panicked at 'called `Result::unwrap()` on
an `Err` value: WinAPI Error(1418)', src\libcore\result.rs:859 note: Run with 
`RUST_BACKTRACE=1` for a backtrace. Press ENTER or type command to continue

Hit this problem this morning and a simple echo hello | win32yank -i is taking 12 seconds. What could’ve changed here?

However, removing it from the Linux side and just installing it on the windows side with Scoop now works fine without delay for me.

I have just added win32yank to Winget too (https://github.com/microsoft/winget-pkgs/pull/108528). You can try that as well 🙂

Related:

However, removing it from the Linux side and just installing it on the windows side with Scoop now works fine without delay for me.

I have just added win32yank to Winget too (microsoft/winget-pkgs#108528). You can try that as well 🙂

Related:

Thank you! Now I can easily install it in WSL 2:

winget.exe install win32yank

Any fix for this??

This still seems to be an issue, any updates regarding it?

I’ve compiled a version 0.0.5 that is from the above PR, at least it works consistently now!

Have you tried WSL2? win32yank 0.4.0 works for me reliably with NVIM v0.5.0-613-g44cbf288e under ArchWSL.