Skip to content

Commit

Permalink
Fix for running cleanup on Firefox exit. Closes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
Frewacom committed Aug 3, 2020
1 parent 880d5a6 commit d11a5ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions pywalfox/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import atexit
import logging
import argparse
import subprocess
Expand Down Expand Up @@ -58,9 +59,8 @@ def print_version():

def run_daemon():
"""Starts the daemon."""
python_version = get_python_version()

daemon = Daemon(python_version.major)
daemon = Daemon(get_python_version().major)
atexit.register(daemon.close)
daemon.start()

def handle_args(args):
Expand Down
2 changes: 1 addition & 1 deletion pywalfox/channel/unix/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ def connect(self, host):
except OSError as e:
logging.error('Failed to connect to socket: %s' % e.strerror)
else:
logging.error('Could not find socket: %s' % host)
logging.debug('Could not find socket: %s' % host)

return False
2 changes: 1 addition & 1 deletion pywalfox/channel/win/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def connect(self, host):
logging.debug('Successfully connected to UDP socket at: %s:%s' % (host[0], host[1]))
return True
except Exception as e:
logging.error('Failed to connect to socket: %s' % str(e))
logging.debug('Failed to connect to socket: %s' % str(e))

return False
6 changes: 1 addition & 5 deletions pywalfox/daemon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import signal
import logging
from threading import Thread

Expand Down Expand Up @@ -29,9 +28,6 @@ def __init__(self, python_version):
self.socket_server = Server()
self.is_running = False

signal.signal(signal.SIGINT, self.close)
signal.signal(signal.SIGTERM, self.close)

def set_chrome_path(self):
"""Tries to set the path to the chrome directory."""
self.chrome_path = get_firefox_chrome_path()
Expand Down Expand Up @@ -208,7 +204,7 @@ def start(self):
logging.debug('Received message from extension: %s' % message)
self.handle_message(message)

def close(self, signal, frame):
def close(self):
"""Application cleanup."""
logging.debug('Running cleanup')
self.is_running = False
Expand Down

0 comments on commit d11a5ff

Please sign in to comment.