markbates / cover_me

An RCov-esque coverage tool for Ruby 1.9
http://www.metabates.com
MIT License
203 stars 18 forks source link

Couldn't get a file descriptor referring to the console #55

Closed bbuchalter closed 6 years ago

bbuchalter commented 13 years ago
brian@ubuntu:~/code/lfm$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
brian@ubuntu:~/code/lfm$ rails -v
Rails 3.1.0.rc4
brian@ubuntu:~/code/lfm$ rake cover_me:report --trace
(in /home/brian/code/lfm)
** Invoke cover_me:report (first_time)
** Execute cover_me:report
Couldn't get a file descriptor referring to the console
brian@ubuntu:~/code/lfm$ 
sanchitg commented 13 years ago

I am getting this message how to resolve it where to write/override default options

btedev commented 13 years ago

I'm seeing the same issue. FWIW, I'm also on Ubuntu (Server 10.0.4 LTS).

KitaitiMakoto commented 13 years ago

CoverMe calls "open" command by default to open browser for Mac OS X, but Ubuntu's "open" is not the same and outputs "Couldn't get a file descriptor referring to the console". If you want to open browser automatically to see coverage report, configure like this:

browser_cmd = 'forefox' # or '/etc/alternatives/x-www-browser' and so on
CoverMe.config do |conf|
  conf.at_exit = proc {
    if CoverMe.config.formatter == CoverMe::HtmlFormatter
      index = File.join(CoverMe.config.html_formatter.output_path, 'index.html')
      if File.exists?(index)
        `#{browser_cmd} #{index}`
      end
    end
  }
end

If not, for instance on a server, simply configure like this:

CoverMe.config do |conf|
  conf.at_exit = proc {}
end
btedev commented 13 years ago

Thanks, the latter fixed it for me.

psahni commented 13 years ago

Solved that problem but files are not generating

KitaitiMakoto commented 13 years ago

You might find a solution in issue #50 or #51.

psahni commented 13 years ago

Decided to remove it from my app

masom commented 12 years ago

This issue exists on non-ubuntu/debian linux distribution. The file /etc/alternatives/x-www-browser does not exists.

For linux, xdg-open [url] is a better bet.