markbates / markbates/cover_me

cover_me: calls wrong command open (probably mean xdg-open?)

Open
#45 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
203
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Ever since cover_me got added to Gemfile on every rake command I invoke I see this:
Couldn't get a file descriptor referring to the console

And if logged on the console I get access denied to /dev/tty7

strace shows cover_me tries to do this:
[pid 4722] execve("/bin/open", ["open", "...site/coverage/index.html"], [/\* 18 vars */]) = 0

cover_me has this code:
c.set_default(:at_exit, Proc.new {
if CoverMe.config.formatter == CoverMe::HtmlFormatter
index = File.join(CoverMe.config.html_formatter.output_path, 'index.html')
if File.exists?(index)
`open #{index}`

I don't know under what OS "open index.html" opens the file in your browser, but on Linux open does something completely different:
lrwxrwxrwx 1 root root 6 Feb 1 21:12 /bin/open -> openvt

DESCRIPTION
openvt will find the first available VT, and run on it the given command with the given command options, standard input, output and error are
directed to that terminal. The current search path ($PATH) is used to find the requested command. If no command is specified then the environment
variable $SHELL is used.

What you are looking for probably is xdg-open:

DESCRIPTION
xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser.
If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https
URLs.

If xdg-open is installed that is...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The affected entry point is CoverMe's HTML formatter at_exit hook, where the generated index.html is passed to open; start by reproducing a rake command on Linux and checking the coverage output path. Verify the chosen opener launches the HTML report in the preferred browser without the /dev/tty errors described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ruby
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.