sake icon indicating copy to clipboard operation
sake copied to clipboard

Windows support

Open gabriel-vanca opened this issue 2 years ago • 8 comments

Would love to see Windows support added to this, both for client and for server side.

gabriel-vanca avatar Jun 11 '22 04:06 gabriel-vanca

It's in the backlog, but I'll make sure to bump it up since there seems to be some demand. What's the preferred shell for windows, powershell?

alajmo avatar Jun 11 '22 20:06 alajmo

Powershell Core, yes. It's cross platform so could be used on the Linux machines too technically.

gabriel-vanca avatar Jun 12 '22 03:06 gabriel-vanca

Powershell +1

codenoid avatar Jun 12 '22 09:06 codenoid

Anyway @alajmo , Is it possible to replace os-spesific command with this library melbahja/goph

codenoid avatar Jun 12 '22 09:06 codenoid

I'll look into it after I'm done with adding some needed unit and integrations tests (not sure how I'll test the remote window server, since I'm running Linux, but perhaps I could do it with Github actions or there's some lightweight virtualization software I could take advantage of).

Concerning goph, I've used some of their code already (their known_hosts logic mainly), but since SSH is central to sake, I think it's better to use golangs std lib rather than a 3rd party lib. This could change in the future though

alajmo avatar Jun 12 '22 20:06 alajmo

Sorry for my negligence, I was seen this function and I'm thinking, why is using user's ssh command, why not using something embed/built-in

core/run/exec.go#L403

codenoid avatar Jun 12 '22 22:06 codenoid

It's because it gets pretty complex when you use RequestPty on the remote hosts. You're left with manually handling all signals, and fixing key presses, for instance, Ctrl + L doesn't clear the screen but prints out ^L, key arrows don't work as you expect, and a lot more things.

So, it's easier to just delegate it to the users ssh (which almost everyone has anyway, and you might even have some configs associated with your ssh in ~/.ssh/config). One more note, we also use unix.Exec to replace the current process, instead of creating a sub-process, where sake commands normally run.

This is a good article https://dev.to/napicella/linux-terminals-tty-pty-and-shell-part-2-2cb2 to learn more about tty, pty and linux terminals.

alajmo avatar Jun 13 '22 09:06 alajmo

Release v0.10.1 now supports

  • overriding the current shell (with the default shell being PowerShell for windows), see sakecli.com/recipes. I haven't tested it thoroughly, so I'll keep this issue open until I've tested the functionality with a remote windows server
  • running sake on windows (released Windows build)

alajmo avatar Jun 28 '22 16:06 alajmo