uitest/libreoffice/connection.py |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 0d21e1075f0288a007cb427ce508d6fbbf8503dd
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Thu Sep 21 07:40:36 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Wed Oct 4 15:51:10 2023 +0200

    uitest: add signal_handler function
    
    install signal handler to analyze if the
    soffice bootstrap has some issues.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I8b05b9c24bf531f4162554433180d80526cb2983
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157144
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157518
    Tested-by: Jenkins

diff --git a/uitest/libreoffice/connection.py b/uitest/libreoffice/connection.py
index 40c4757406ab..101a5385fd4a 100644
--- a/uitest/libreoffice/connection.py
+++ b/uitest/libreoffice/connection.py
@@ -10,6 +10,7 @@ import time
 import traceback
 import uuid
 import os
+import signal
 
 try:
     import pyuno
@@ -20,6 +21,9 @@ except ImportError:
     print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
     raise
 
+def signal_handler(signal_num, frame):
+    signal_name = signal.Signals(signal_num).name
+    print(f'Signal handler called with signal {signal_name} ({signal_num})', 
flush=True)
 
 class OfficeConnection:
     def __init__(self, args):
@@ -33,6 +37,9 @@ class OfficeConnection:
         If the connection method is path the instance will be created as a
         new subprocess. If the connection method is connect the instance tries
         to connect to an existing instance with the specified socket string """
+        signal.signal(signal.SIGCHLD, signal_handler)
+        signal.signal(signal.SIGPIPE, signal_handler)
+
         (method, sep, rest) = self.args["--soffice"].partition(":")
         if sep != ":":
             raise Exception("soffice parameter does not specify method")

Reply via email to