Title: [233979] trunk/Tools
- Revision
- 233979
- Author
- [email protected]
- Date
- 2018-07-19 01:24:27 -0700 (Thu, 19 Jul 2018)
Log Message
[Flatpak] Let flatpak process handle SIGINT
https://bugs.webkit.org/show_bug.cgi?id=187521
Patch by Thibault Saunier <[email protected]> on 2018-07-19
Reviewed by Philippe Normand.
Ensuring that flatpak process ends properly and that the sandbox is teard down.
It also avoids showing usless backtrace to the end user and makes gdb
much more usable.
Also make flatpakutils not verbose by default
* flatpak/flatpakutils.py:
(disable_signals):
(WebkitFlatpak.run_in_sandbox):
(WebkitFlatpak.run_gdb):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (233978 => 233979)
--- trunk/Tools/ChangeLog 2018-07-19 05:40:20 UTC (rev 233978)
+++ trunk/Tools/ChangeLog 2018-07-19 08:24:27 UTC (rev 233979)
@@ -1,3 +1,21 @@
+2018-07-19 Thibault Saunier <[email protected]>
+
+ [Flatpak] Let flatpak process handle SIGINT
+ https://bugs.webkit.org/show_bug.cgi?id=187521
+
+ Reviewed by Philippe Normand.
+
+ Ensuring that flatpak process ends properly and that the sandbox is teard down.
+ It also avoids showing usless backtrace to the end user and makes gdb
+ much more usable.
+
+ Also make flatpakutils not verbose by default
+
+ * flatpak/flatpakutils.py:
+ (disable_signals):
+ (WebkitFlatpak.run_in_sandbox):
+ (WebkitFlatpak.run_gdb):
+
2018-07-18 Stephan Szabo <[email protected]>
Unreviewed. Fix contributors entry.
Modified: trunk/Tools/flatpak/flatpakutils.py (233978 => 233979)
--- trunk/Tools/flatpak/flatpakutils.py 2018-07-19 05:40:20 UTC (rev 233978)
+++ trunk/Tools/flatpak/flatpakutils.py 2018-07-19 08:24:27 UTC (rev 233979)
@@ -20,11 +20,13 @@
import configparser
except ImportError:
import ConfigParser as configparser
+from contextlib import contextmanager
import errno
import json
import os
import shlex
import shutil
+import signal
import subprocess
import sys
import tempfile
@@ -444,6 +446,20 @@
*extra_args, comment=comment)
+@contextmanager
+def disable_signals(signals=[signal.SIGINT]):
+ old_signal_handlers = []
+
+ for disabled_signal in signals:
+ old_signal_handlers.append((disabled_signal, signal.getsignal(disabled_signal)))
+ signal.signal(disabled_signal, signal.SIG_IGN)
+
+ yield
+
+ for disabled_signal, previous_handler in old_signal_handlers:
+ signal.signal(disabled_signal, previous_handler)
+
+
class WebkitFlatpak:
@staticmethod
@@ -517,7 +533,7 @@
self.sdk_debug = None
self.app = None
- self.verbose = True
+ self.verbose = False
self.quiet = False
self.packs = []
self.update = False
@@ -704,11 +720,12 @@
_log.debug('Running in sandbox: "%s" %s\n' % ('" "'.join(flatpak_command), shell_string))
flatpak_command.extend(['sh', "/run/host/" + tmpscript.name])
- try:
- subprocess.check_call(flatpak_command, stdout=stdout)
- except subprocess.CalledProcessError as e:
- sys.stderr.write(str(e) + "\n")
- return e.returncode
+ with disable_signals():
+ try:
+ subprocess.check_call(flatpak_command, stdout=stdout)
+ except subprocess.CalledProcessError as e:
+ sys.stderr.write(str(e) + "\n")
+ return e.returncode
return 0
@@ -794,11 +811,12 @@
package.install()
def run_gdb(self):
- try:
- subprocess.check_output(['which', 'coredumpctl'])
- except subprocess.CalledProcessError as e:
- sys.stderr.write("'coredumpctl' not present on the system, can't run. (%s)\n" % e)
- return e.returncode
+ with disable_signals():
+ try:
+ subprocess.check_output(['which', 'coredumpctl'])
+ except subprocess.CalledProcessError as e:
+ sys.stderr.write("'coredumpctl' not present on the system, can't run. (%s)\n" % e)
+ return e.returncode
# We need access to the host from the sandbox to run.
with tempfile.NamedTemporaryFile() as coredump:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes