Error when used with sinatra on Windows #1

Closed
rockuw opened this Issue Apr 13, 2013 · 7 comments

3 participants

@rockuw

It throws "Sys::Uname::Error: failed to parse display name of moniker" exception when used with sinatra on Windows. It works fine alone.

Here is the code to repeat the error:
web.rb:

require 'sinatra'
require 'sys/uname'

class Web < Sinatra::Base
  get '/test' do
    Sys::Uname.sysname
  end
end

Web.run!

Run the script in the command line with ruby web.rb, then type the address in the browser: http://localhost:4567/test. We got this error. Other methods such as Sys::Uname.version fails the same way.
And if we add WIN32OLE.ole_initialize before Sys::Uname.sysname it works fine.

I'm using ruby-1.9.3-p392 on Windows 7.

@djberg96
Owner

I'll take a look, thanks for the report.

@djberg96
Owner

I think this issue might be a bug in win32ole. Here's a patch that was proposed 2 years ago:

https://gist.github.com/cowlibob/717446

@djberg96
Owner

Should be fixed in 0.9.2.

@djberg96 djberg96 closed this May 1, 2013
@poyomunandar

Hi I still get this problem now by using sys-uname-0.9.2-universal-mingw32. Do I need to use the patch?

@djberg96
Owner

Hm, what version of Ruby are you using?

@djberg96
Owner

I couldn't get it to work with 1.9.3, even with that patch. YMMV. In any case, redefining Thread#initialize is something I leave to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment