-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fixed so PATH modification doesnt error on windows #27
Conversation
It seems like you are trying to change |
Yep that's what I'm trying to do. The previous method gave an error on windows. Could also change from backticks to system but I thought that would be riskier and wanted something simple, particularly given the tests dont work for me. |
Interesting. I guess if this works then it should be fine. I wish we had a good test case for this actually working the whole way through. We'd probably have to vendor ghostscript and imagemagick and somehow do something that ensured we knew we were using the vendored ghostscript version. Sounds like a pain. :) @jonmagic any thoughts? |
I'd be keen on trying out http://ruby-doc.org/core-2.3.1/Kernel.html#method-i-system first to see if we can modify the ENV for that single command without having to change PATH back in @BJgordon would you be up for testing out:
I'm curious if Windows will respect it if we run it that way. |
@jonmagic Yep that code's fine for me on windows. |
I don't know if you are right, but it definitely makes a difference on SpeakerDeck. We use it currently to alter the version of ghostscript used by imagemagick and have confirmed that it works as we intended. |
Ok, I think command_env = {}
if @ghostscript_path && @ghostscript_path != DefaultGhostScriptPath
command_env["PATH"] = "#{File.dirname(@ghostscript_path)}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
end
result, status = Open3.capture2e(command_env, command.join(" "))
status.success? || raise(UnprocessablePage, result) We'll also want to add |
Thanks, it works for me on Windows. |
@BJgordon if you are up for updating this PR with the suggested changes I can test it with Speaker Deck and then merge if it all works as expected. |
@jonmagic sure thing will do |
Done. |
Tested. Merging and I will cut a new version of Grim as soon as I get a couple of other improvements in. |
Fix for #25. The tests wouldnt pass on windows, but fixes the error and everything seems to work. Hopefully it works on *nix...