-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I'm opening this issue to discuss the best way to add Windows support, along with what I've found so far. I'd be happy to contribute a Windows implementation, including tests, but will require your guidance in order to do so effectively.
The current implementation of localexec_windows.go is an empty stub. By copying the implementation from localexec_unix.go and removing the non-portable Linux-specific parts (syscall, UID/GID), I was able to get a partial implementation running on Windows 10 under MinGW (Git Bash). I don't know if this is one of your near-term goals, but I thought you might be interested nonetheless.
Some caveats of the example I hacked together:
- I didn't implement TTY support or Resize
- A bunch of the integration tests are still failing
- This required a modification to ./dev/client/main.go to remove the build tag and comment out the SIGWINCH signals
Here's what I have working so far:
$ go version
go version go1.15.5 windows/amd64
$ go run ./dev/client notty ls
browser
ci
client.go
client_test.go
dev
doc.go
exec.go
go.mod
go.sum
internal
LICENSE.txt
localexec.go
localexec_test.go
localexec_unix.go
localexec_windows.go
README.md
server.go
tty_test.go
$ go run ./dev/client notty ps ux
PID PPID PGID WINPID TTY UID STIME COMMAND
716 1 716 10016 cons0 1051769 11:33:25 /usr/bin/bash
810 716 810 252 cons0 1051769 11:35:48 /c/Program Files/Go/bin/go
760 1 760 23620 cons1 1051769 11:33:42 /usr/bin/bash
814 760 814 12756 cons1 1051769 11:37:38 /c/Program Files/Go/bin/go
815 1 815 8208 ? 1051769 11:37:50 /usr/bin/ps
If I use the Command Prompt to start the server, then the results aren't as nice, however:
C:\projects\wsep>go run ./dev/server
2020-11-29 12:04:17 ERROR failed to serve execer: start command: exec: "dir": executable file not found in %PATH%
2020/11/29 12:04:17 websocket: failed to marshal close frame: status code StatusAbnormalClosure cannot be set
exit status 2
A similar issue for PowerShell, too:
PS C:\projects\wsep> go run ./dev/server
2020-11-29 12:02:31 ERROR failed to serve execer: start command: exec: "ls": executable file not found in %PATH%
2020/11/29 12:02:31 websocket: failed to marshal close frame: status code StatusAbnormalClosure cannot be set
2020-11-29 12:02:45 ERROR failed to serve execer: start command: exec: "dir": executable file not found in %PATH%
2020/11/29 12:02:45 websocket: failed to marshal close frame: status code StatusAbnormalClosure cannot be set
exit status 2
PS C:\projects\wsep> dir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 11/29/2020 11:22 .github
d----- 11/29/2020 11:22 browser
d----- 11/29/2020 11:22 ci
d----- 11/29/2020 11:22 dev
d----- 11/29/2020 11:22 internal
-a---- 11/29/2020 11:22 7 .gitignore
-a---- 11/29/2020 11:22 5276 client.go
-a---- 11/29/2020 11:22 3552 client_test.go
-a---- 11/29/2020 11:22 223 doc.go
-a---- 11/29/2020 11:22 1813 exec.go
-a---- 11/29/2020 11:22 432 go.mod
-a---- 11/29/2020 11:22 28298 go.sum
-a---- 11/29/2020 11:22 1083 LICENSE.txt
-a---- 11/29/2020 11:22 1022 localexec.go
-a---- 11/29/2020 11:22 3415 localexec_test.go
-a---- 11/29/2020 11:22 2279 localexec_unix.go
-a---- 11/29/2020 11:35 1381 localexec_windows.go
-a---- 11/29/2020 11:22 2360 README.md
-a---- 11/29/2020 11:22 3732 server.go
-a---- 11/29/2020 11:22 1283 tty_test.go