diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2019-05-14 18:37:54 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2019-05-14 18:37:54 +0200 |
commit | 4c47182a3e6c7d9e09042e6d60f7578f52339a8a (patch) | |
tree | a7b09e80afc2abbc68f1bd3044fa3e36c5f0caa4 | |
parent | 2efdf8b12d522b844c18d4dd298b6d67018a9525 (diff) |
#908: Fix bug when killing the old browser before launching the new one.
-rw-r--r-- | admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py index fd6c1cba..04c7ebc5 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -118,9 +118,14 @@ class OpenGnSysWorker(ServerWorker): :param url: URL to show """ logger.debug('Launching browser with URL: {}'.format(url)) - if hasattr(self.browser, 'process'): - self.browser['process'].kill() - os.kill(self.browser['process'].pid, signal.SIGINT) + # Trying to kill an old browser + try: + os.kill(self.browser['process'].pid, signal.SIGKILL) + except OSError: + logger.warn('Cannot kill the old browser process') + except KeyError: + # There is no previous browser + pass self.browser['url'] = url self.browser['process'] = subprocess.Popen(['browser', '-qws', url]) |