Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causes LoadError when executing on Windows #36

Open
yutakat opened this issue Jul 14, 2014 · 6 comments
Open

Causes LoadError when executing on Windows #36

yutakat opened this issue Jul 14, 2014 · 6 comments

Comments

@yutakat
Copy link

yutakat commented Jul 14, 2014

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
Copy link
Author

yutakat commented Jul 14, 2014

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

@AlexAkulov
Copy link

I have thesame problem. How to corrent it?

@existentialmutt
Copy link
Owner

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" notifications@github.com wrote:

I have thesame problem. Have to corrent it?


Reply to this email directly or view it on GitHub
#36 (comment)
.

@calsioro
Copy link

calsioro commented Jan 5, 2016

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

@lmtthws
Copy link

lmtthws commented Jan 19, 2016

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)])]

existentialmutt pushed a commit that referenced this issue Feb 13, 2016
@existentialmutt
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants