diff options
author | Micah Lee <micah@micahflee.com> | 2020-08-27 15:07:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 15:07:58 -0700 |
commit | 74a945620fb9506d18ef0859540e1e5fcb122ead (patch) | |
tree | 2a8abb7047cd34f7a53708551c934c4c873ecb0d /onionshare | |
parent | 16c5ee722d1ee580f8cd29c12e844ae9a1f34077 (diff) | |
parent | 6b53e3f2c52d346de8a51d20b87ce04dc9a125c4 (diff) | |
download | onionshare-74a945620fb9506d18ef0859540e1e5fcb122ead.tar.gz onionshare-74a945620fb9506d18ef0859540e1e5fcb122ead.zip |
Merge pull request #1161 from micahflee/1076_mac_win_tests
Make GUI test suite run in Windows and macOS
Diffstat (limited to 'onionshare')
-rw-r--r-- | onionshare/mode_settings.py | 5 | ||||
-rw-r--r-- | onionshare/onion.py | 19 |
2 files changed, 14 insertions, 10 deletions
diff --git a/onionshare/mode_settings.py b/onionshare/mode_settings.py index 8216c1d8..f141f8c5 100644 --- a/onionshare/mode_settings.py +++ b/onionshare/mode_settings.py @@ -18,8 +18,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import os -import pwd import json +import platform + +if platform.system() == "Darwin": + import pwd class ModeSettings: diff --git a/onionshare/onion.py b/onionshare/onion.py index 4fca31d5..614fa76e 100644 --- a/onionshare/onion.py +++ b/onionshare/onion.py @@ -669,15 +669,16 @@ class Onion(object): Stop a specific onion service """ onion_host = mode_settings.get("general", "service_id") - self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}") - try: - self.c.remove_ephemeral_hidden_service( - mode_settings.get("general", "service_id") - ) - except: - self.common.log( - "Onion", "stop_onion_service", f"failed to remove {onion_host}" - ) + if onion_host: + self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}") + try: + self.c.remove_ephemeral_hidden_service( + mode_settings.get("general", "service_id") + ) + except: + self.common.log( + "Onion", "stop_onion_service", f"failed to remove {onion_host}" + ) def cleanup(self, stop_tor=True): """ |