Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when sysctl is not available #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pedrib
Copy link

@pedrib pedrib commented Apr 12, 2020

This fixes a bug that happens (at least on my machine) when sysctl is not executable by a non-root user.
Without it, this happens:

autochrome > ruby autochrome.rb -d autochrome_install/
[???] Detected Linux (x86_64)
Traceback (most recent call last):
        7: from autochrome.rb:90:in `<main>'
        6: from autochrome.rb:90:in `new'
        5: from tools/autochrome/lib/auto_chrome.rb:107:in `initialize'
        4: from tools/autochrome/lib/processor/chrome.rb:49:in `new_from_type'
        3: from tools/autochrome/lib/processor/chrome.rb:49:in `new'
        2: from tools/autochrome/lib/processor/unix.rb:9:in `initialize'
        1: from tools/autochrome/lib/processor/linux.rb:14:in `sanity_check'
tools/autochrome/lib/processor/linux.rb:14:in ``': No such file or directory - sysctl (Errno::ENOENT)

The fix is to surround the sysctl command with a begin / rescue statement for Errno::ENOENT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant