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

Errors are being redireceted to /dev/null #30

Closed
aeonik opened this issue Sep 27, 2023 · 1 comment
Closed

Errors are being redireceted to /dev/null #30

aeonik opened this issue Sep 27, 2023 · 1 comment

Comments

@aeonik
Copy link

aeonik commented Sep 27, 2023

picosnitch/picosnitch.py

Lines 2330 to 2334 in 34f9f1f

subprocess.Popen(["bash", "-c", f'/usr/bin/env python3 -m webbrowser -t http://{os.getenv("HOST", "localhost")}:{os.getenv("PORT", "5100")}'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return ui_dash()
subprocess.Popen(["bash", "-c", f'let i=0; rm {BASE_PATH}/dash; while [[ ! -f {BASE_PATH}/dash || "$i" -gt 30 ]]; do let i++; sleep 1; done; rm {BASE_PATH}/dash && /usr/bin/env python3 -m webbrowser -t http://{os.getenv("HOST", "localhost")}:{os.getenv("PORT", "5100")}'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
args = ["bash", "-c", f"touch {BASE_PATH}/dash; nohup {sys.executable} \"{os.path.abspath(__file__)}\" start-dash > /dev/null 2>&1 &"]
os.execvp("bash", args)

Hello,
Please remove the redirections and pipes to /dev/null for errors. You may want to consider removing all /dev/null redirections.

I got picosnitch up and running today, but with some difficulty. picosnitch dash wasn't starting, and gave no error messages, nor logs.

I had to open up my Python IDE in order to trace the code. I removed these /dev/null statements, and eventually found that Arch Linux currently has out of date packages for python-dash, which breaks with newer versions of Flask.

I have submitted changes to the Arch User Repo to get these packages updated, however I would appreciate not hiding these error messages. In case packages get updated and break things in the future, users will be able to troubleshoot what is wrong with their system more easily.

Love your work!

Regards,
Aeonik

@elesiuta
Copy link
Owner

Thank you!

The command picosnitch dash is intended to be more "user friendly" and completely detach itself from the terminal, but I agree showing the errors would be helpful. There is also the currently undocumented command picosnitch start-dash which does not detach itself nor pipe to /dev/null.

Maybe when dash launches, the below print statement could also suggest trying start-dash to see any error messages if dash fails to open.

picosnitch/picosnitch.py

Lines 2326 to 2330 in 34f9f1f

except Exception:
pass
print(f"serving web gui on http://{os.getenv('HOST', 'localhost')}:{os.getenv('PORT', '5100')}")
if sys.executable.startswith("/snap/") or sys.executable.startswith("/nix/"):
subprocess.Popen(["bash", "-c", f'/usr/bin/env python3 -m webbrowser -t http://{os.getenv("HOST", "localhost")}:{os.getenv("PORT", "5100")}'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

It is also probably worth mentioning the DASH_DEBUG environment variable which enables the dash dev tools when true.

The same also goes for picosnitch start and picosnitch start-no-daemon (but this is already the command systemd uses so you'd see the errors in journalctl).

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

No branches or pull requests

2 participants