Causes LoadError when executing on Windows
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
Sorry I forgot to tell OS version. It was Windows 7 (x64)
I have thesame problem. How to corrent it?
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 .
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
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)])]
Hey Windows folks-- I got around to pushing a new version that implements @lmtthws 's suggestion. Let me know how it works.