boz/kail

Cannot use kail on Windows/Git Bash -- cannot open `/dev/stderr`

fbiville opened this issue · 6 comments

Here is what happens:

$ kail --help
kail.exe: error: open /dev/stderr: The system cannot find the path specified., try --help

A few more details on the setup:

IEUser@MSEDGEWIN10 MINGW64 ~/workspace/fats (issue_46)
$ kail --help
kail.exe: error: open /dev/stderr: The system cannot find the path specified., try --help

IEUser@MSEDGEWIN10 MINGW64 ~/workspace/fats (issue_46)
$ ls -lisa /dev/stderr
562949953534840 1 lrwxrwxrwx 1 IEUser 197121 15 Oct 17 08:02 /dev/stderr -> /proc/self/fd/2

IEUser@MSEDGEWIN10 MINGW64 ~/workspace/fats (issue_46)
$ ls -lisa /proc/self/fd/2
15871480675977711661 0 lrwxrwxrwx 1 IEUser 197121 0 Oct 17 09:01 /proc/self/fd/2 -> /dev/pty0

IEUser@MSEDGEWIN10 MINGW64 ~/workspace/fats (issue_46)
$ ls -lisa /dev/pty0
8912896 0 crw------- 1 IEUser 197121 136, 0 Oct 17 09:02 /dev/pty0
boz commented

Thanks @fbiville. I'm not sure why your workaround doesn't work. Maybe just create a /dev directory?

You can also try specifying a different log file with --log-file <path>.

It's opening /dev/stderr for logging as a convenience, maybe that just won't work on Windows. The relevant code is here.

What is os.Stderr.Name() on your system? I wonder if it's a different path or if the open flags won't work on Windows.

@boz actually, this whole setup is a standard Git Bash install (used by Travis CI as well on Windows workers). I'll come back to you ASAP with the value os.Stderr.Name()

Just ran it, it returns /dev/stderr in Git Bash, cmd and Powershell.

I've been able to work around this issue by redirecting stderr to stdout 2>&1. There's something a bit different with git bash on Windows.

does not work on PowerShell either