markbates/cover_me

Couldn't get a file descriptor referring to the console

bbuchalter opened this issue · 8 comments

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$ 

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

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

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

Thanks, the latter fixed it for me.

Solved that problem
but files are not generating

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

Decided to remove it from my app

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.