Skip to content

Commit

Permalink
Ignore SIGINT in D-Bus launcher and x11 too
Browse files Browse the repository at this point in the history
When we do install, especially use TUI to install, we some time have take
a mistake to put "CTRL+C", then there will be stop with traceback. And we
know the main process have shielded SIGINT, so we to shield subprocesses also.
  • Loading branch information
iasunsea authored and VladimirSlavik committed Dec 6, 2022
1 parent 5137fa1 commit d8060d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pyanaconda/core/startup/dbus_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Author(s): Jiri Konecny <jkonecny@redhat.com>
#
import os
import signal
from subprocess import TimeoutExpired

from pyanaconda.core.configuration.anaconda import conf
Expand Down Expand Up @@ -109,9 +110,14 @@ def _start_dbus_session(self):
"--syslog",
"--config-file={}".format(ANACONDA_BUS_CONF_FILE)
]

def dbus_preexec():
# to set dbus subprocess SIGINT handler
signal.signal(signal.SIGINT, signal.SIG_IGN)

self._log_file = open('/tmp/dbus.log', 'a')
self._dbus_daemon_process = startProgram(command, stderr=self._log_file, reset_lang=False)
self._dbus_daemon_process = startProgram(command, stderr=self._log_file, reset_lang=False,
preexec_fn=dbus_preexec)

if self._dbus_daemon_process.poll() is not None:
raise RuntimeError("DBus wasn't properly started!")
Expand Down
8 changes: 7 additions & 1 deletion pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import time
import textwrap
import pkgutil
import signal

from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.process_watchers import WatchProcesses
Expand Down Expand Up @@ -192,8 +193,13 @@ def do_startup_x11_actions():
else:
xdg_data_dirs = datadir + '/window-manager:/usr/share'

def x11_preexec():
# to set GUI subprocess SIGINT handler
signal.signal(signal.SIGINT, signal.SIG_IGN)

childproc = util.startProgram(["gnome-kiosk", "--display", ":1", "--sm-disable", "--x11"],
env_add={'XDG_DATA_DIRS': xdg_data_dirs})
env_add={'XDG_DATA_DIRS': xdg_data_dirs},
preexec_fn=x11_preexec)
WatchProcesses.watch_process(childproc, "gnome-kiosk")


Expand Down

0 comments on commit d8060d0

Please sign in to comment.