diff --git a/lib/execjs/external_runtime.rb b/lib/execjs/external_runtime.rb index 811dd69..8a924d6 100644 --- a/lib/execjs/external_runtime.rb +++ b/lib/execjs/external_runtime.rb @@ -28,8 +28,15 @@ module ExecJS source = @runtime.compile_source(source) tmpfile = write_to_tempfile(source) + + if ExecJS.cygwin? + filepath = `cygpath -m #{tmpfile.path}`.rstrip + else + filepath = tmpfile.path + end + begin - extract_result(@runtime.exec_runtime(tmpfile.path), tmpfile.path) + extract_result(@runtime.exec_runtime(filepath), filepath) ensure File.unlink(tmpfile) end diff --git a/lib/execjs/module.rb b/lib/execjs/module.rb index 6d155af..8b2566a 100644 --- a/lib/execjs/module.rb +++ b/lib/execjs/module.rb @@ -34,5 +34,9 @@ module ExecJS def windows? @windows ||= RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ end + + def cygwin? + @cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/ + end end end