Last active
January 29, 2024 20:53
-
-
Save tofran/dbee8010e222ad3591dc82d2a63a0d06 to your computer and use it in GitHub Desktop.
Simle utility to fake Python's `webbroser` and be able to bypass code that relies on it when there's no browser on the system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Simle utility to fake Python's `webbroser` (https://docs.python.org/3/library/webbrowser.html). | |
# Usefull for when no GUI is available. For example inside a Docker container. | |
# | |
# Copy paste this code the terminal: | |
export BROWSER="~/fake-browser.sh:$BROWSER" | |
echo 'echo "Fake browser called with: $@" && touch ~/fake-browser.log && echo "$@" >> ~/fake-browser.log' > ~/fake-browser.sh | |
chmod +x ~/fake-browser.sh | |
# That's it! | |
# Test your browser by running: ~/fake-browser.sh something | |
# It should output to the stdout and also ~/fake-browser.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment