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

Using win32yank on WSL prints extra line on stdout #3

Open
gglanzani opened this issue May 3, 2017 · 6 comments
Open

Using win32yank on WSL prints extra line on stdout #3

gglanzani opened this issue May 3, 2017 · 6 comments

Comments

@gglanzani
Copy link

Calling win32yank on WSL prints to stdout (before the clipboard is printed) the following line

Unable to translate current working directory. Using C:\Users\G

The tool is basically working when calling it from neovim inside Windows Subsystem from Linux. However that line gets printed everywhere, which is annoying :)

I've looked at the code, but there were no mentions of this so maybe it's rust doing this

@equalsraf
Copy link
Owner

There are a couple of similar issues around in github microsoft/WSL#2011

Likely some code is trying to figure out its current directory and having issues with the unexpected path and/or environment vars.

I wonder if setting $CD to a valid path works around it?

@gglanzani
Copy link
Author

No, setting $CD doesn't help unfortunately :(

I was trying to make a shell script that changes folder to a Windows folder and then calls win32yank.exe, but I don't have much luck: the -o option pastes twice for example.

@equalsraf
Copy link
Owner

@gglanzani trying to reproduce this on Windows, but I do not get that message with any of the following

win32yank.exe -o
win32yank.exe -o --lf

I just updated windows so that might be the cause winver.exe reports OS build 15063.250

@equalsraf
Copy link
Owner

It seems this only happens when using a symlink to the actual binary, like the example in the neovim wiki.

@raffylopez
Copy link

Installing Xming for Windows, and then making sure to run export DISPLAY=:0 on the shell fixed this for me on neovim.

@mqudsi
Copy link

mqudsi commented Jul 14, 2017

It's not a symlink issue and there's no straight-forward fix for this - it's an error generated by the WSL subsystem when cwd is inside the lxsys filesystem which isn't accessible from win32.

The fix is to call win32yank.exe via a Linux-side program/script which will filter that.

Here's my solution:

cat win32yank.exe

#!/bin/bash
win32yank.exe "$@" 2> >(sed -e '1h;2,$H;$!d;g' -r -e 's/Unable to translate[^\n]*\n//' 1>&2) 

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

No branches or pull requests

4 participants