1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Merge pull request #9 from panyamin/patch-2

Cygwin support
This commit is contained in:
Rafael Mendonça França 2015-03-27 15:35:22 -03:00
commit e8dd15f0c7
2 changed files with 12 additions and 1 deletions

View file

@ -28,8 +28,15 @@ module ExecJS
source = @runtime.compile_source(source) source = @runtime.compile_source(source)
tmpfile = write_to_tempfile(source) tmpfile = write_to_tempfile(source)
if ExecJS.cygwin?
filepath = `cygpath -m #{tmpfile.path}`.rstrip
else
filepath = tmpfile.path
end
begin begin
extract_result(@runtime.exec_runtime(tmpfile.path), tmpfile.path) extract_result(@runtime.exec_runtime(filepath), filepath)
ensure ensure
File.unlink(tmpfile) File.unlink(tmpfile)
end end

View file

@ -34,5 +34,9 @@ module ExecJS
def windows? def windows?
@windows ||= RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ @windows ||= RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
end end
def cygwin?
@cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/
end
end end
end end