lt-ruby icon indicating copy to clipboard operation
lt-ruby copied to clipboard

Causes LoadError when executing on Windows

Open yutakat opened this issue 11 years ago • 6 comments

When executing Ruby-Instarepl on Windows, it causes "Invalid argument" error as below

ruby: Invalid argument -- "C:/Users/yutaka/AppData/Local/LightTable/plugins/Ruby _Instarepl/rb-src/lt_client.rb" (LoadError)

After investigating, I found that lt-ruby invoked ruby with following argument, and it causes the error above.

ruby ""C:\Users\yutaka\AppData\Local\LightTable\plugins\Ruby_Instarepl\rb-src\lt_client.rb"" 63336 985

It looks like lt_client.rb is over-quoted and function escape-spaces needs to be revised...

Versions: Light Table 0.6.7 ruby 2.0.0p481 (2014-05-08) [x64-mingw32] Ruby-instarepl 0.0.15

yutakat avatar Jul 14 '14 18:07 yutakat

Sorry I forgot to tell OS version. It was Windows 7 (x64)

yutakat avatar Jul 14 '14 18:07 yutakat

I have thesame problem. How to corrent it?

AlexAkulov avatar Apr 11 '15 19:04 AlexAkulov

Thanks for the reports. I don't have a windows install readily available, which makes it difficult to test any fixes. I will admit that I fumbled around getting the escaping right for bash on OS X/ Linux and it could probably be done more elegantly.

I'll happily merge any pull requests that get it working on all platforms. On Apr 11, 2015 3:23 PM, "AlexAkulov" [email protected] wrote:

I have thesame problem. Have to corrent it?

— Reply to this email directly or view it on GitHub https://github.com/existentialmutt/lt-ruby/issues/36#issuecomment-91909098 .

existentialmutt avatar Apr 12 '15 01:04 existentialmutt

FFIW i went in the compiled .js and changed both """ (escaped ) to "" (empty strings). "ruby instarepl_compiled.js":925 I don't have the clojurescript compiler or dev version of light table to mess with your code, the change corresponds to "ruby.cljs":79 in function "escape-spaces". [edit] ~~Also, not immediately obvious was that i had to write the path in user.behaviors with foward-slashes.~~ ~~I.e: "D:/Ruby22-x64/bin/ruby.exe" instead of "D:\Ruby22-x64\bin\ruby.exe"~~ nvm, it works both ways

calsioro avatar Jan 05 '16 13:01 calsioro

It looks like proc/exec ultimately hands things over to node's ChildProcess.spawn. That handles putting quotes around arguments with spaces for us, so we probably don't need the escape-spaces function at all.

I fixed this by editing .\src\lt\plugins\ruby.cljs (in lighttable so it would recompile the js file for me) and updating the args var in the run-rb function as follows:

original: args (if use-runner [runner-path project-path (bash-escape-spaces rb-path) tcp/port (clients/->id client)] [(escape-spaces rb-path) tcp/port (clients/->id client)])]

modified: args (if use-runner [runner-path project-path (bash-escape-spaces rb-path) tcp/port (clients/->id client)] [rb-path tcp/port (clients/->id client)])]

lmtthws avatar Jan 19 '16 19:01 lmtthws

Hey Windows folks-- I got around to pushing a new version that implements @lmtthws 's suggestion. Let me know how it works.

existentialmutt avatar Feb 13 '16 23:02 existentialmutt