sindresorhus / open

Open stuff like URLs, files, executables. Cross-platform.
MIT License
3.19k stars 222 forks source link

Does not work correctly in sudo mode #271

Open jiaqidegege opened 2 years ago

jiaqidegege commented 2 years ago

When i run sudo open http://localhost:80, it didn't open default browser(chrome) but safari. If remove sudo, it works.

env info: OS: macOS Catalina 10.15.7 shell: zsh node version: 12.22.2 open version: 7.0.3 default browser: Chrome 96.0.4664.93 step to reproduce: run sudo open http://localhost:80

Uzlopak commented 2 years ago

Well i assume the default browser of your root user is safari and not chrome.

jiaqidegege commented 2 years ago

Well i assume the default browser of your root user is safari and not chrome.

Yes, this is mostly like the problem, but how to set default browser for root user, could you give me some help, tks.