How do I access Linux binaries from Windows when u

2020-08-01 05:10发布

问题:

I'm experimenting with the new Windows Subsystem for Linux as a way to develop Rails applications in Windows. I have WSL installed and I have Ruby in it but how do I use that Ruby from a Windows GUI application, specifically, RubyMine:

This is so I can easily start rails, run tests, etc.

回答1:

If anyone is wondering how this can be done at this time with the latest version of Ruby, there is a WSL connector for the remote repo of ruby.



回答2:

A few things:

  1. Open a bash console and leave it open when you're running RubyMine: As soon as you close your last bash session, WSL tears down all running Linux processes.
  2. I believe RubyMine is a 32-bit app. WSL's tools are 64-bit. Therefore you need to call c:\\Windows\\Sysnative\\Bash.exe to invoke the 64-bit Bash.exe from a 32-bit app.
  3. (While your bash console is open) You can either call bash & ask it to execute your command: c:\\Windows\\Sysnative\\Bash.exe -c "<command>", or you can start sshd in Bash and then "remote" into it from RubyMine and drive ruby as if you were driving a remote Linux box/VM.