1 Star 0 Fork 107

kubuds/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Ignore-SIGINT-in-D-Bus-launcher-and-x11-too.patch 2.76 KB
一键复制 编辑 原始数据 按行查看 历史
sun_hai 提交于 2023-07-09 21:36 . sync from sp2
From d8060d01a01e3d5b187ae4388f10b0d0c2c0c4f3 Mon Sep 17 00:00:00 2001
From: iasunsea <iasunsea@sina.com>
Date: Tue, 6 Dec 2022 18:24:50 +0800
Subject: [PATCH] Ignore SIGINT in D-Bus launcher and x11 too
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.
Conflict:NA
Reference:https://github.com/rhinstaller/anaconda/commit/d8060d01a01e3d5b187ae4388f10b0d0c2c0c4f3
---
pyanaconda/core/startup/dbus_launcher.py | 6 ++++++
pyanaconda/display.py | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/core/startup/dbus_launcher.py b/pyanaconda/core/startup/dbus_launcher.py
index 2881c28..a866df0 100644
--- a/pyanaconda/core/startup/dbus_launcher.py
+++ b/pyanaconda/core/startup/dbus_launcher.py
@@ -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
@@ -109,6 +110,10 @@ class AnacondaDBusLauncher(object):
"--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(
@@ -117,6 +122,7 @@ class AnacondaDBusLauncher(object):
env_add={"LANG": DEFAULT_LANG},
env_prune=["LANGUAGE", "LC_ALL", "LC_MESSAGES"],
reset_lang=False,
+ preexec_fn=dbus_preexec
)
if self._dbus_daemon_process.poll() is not None:
diff --git a/pyanaconda/display.py b/pyanaconda/display.py
index ddf24fb..ed163e7 100644
--- a/pyanaconda/display.py
+++ b/pyanaconda/display.py
@@ -24,6 +24,7 @@ import subprocess
import time
import textwrap
import pkgutil
+import signal
from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.core.process_watchers import WatchProcesses
@@ -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(["metacity", "--display", ":1", "--sm-disable"],
- env_add={'XDG_DATA_DIRS': xdg_data_dirs})
+ env_add={'XDG_DATA_DIRS': xdg_data_dirs},
+ preexec_fn=x11_preexec)
WatchProcesses.watch_process(childproc, "metacity")
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kubuds/anaconda.git
git@gitee.com:kubuds/anaconda.git
kubuds
anaconda
anaconda
master

搜索帮助