[Python] xfce4-terminal cannot be killed

Discussão em 'Python' iniciado por Stack, Julho 27, 2025.

  1. Stack

    Stack Membro Participativo

    From a Python program, I start xfce4-terminal as a subprocess. When calling .terminate(), xfce4-terminal is still there. Not nice. So I tried to kill it more abruptly - surprisingly, the corresponding process with corresponding PID is not there anymore... Some ancient and dangerous black magic is happening there (?). See by yourself:

    >>> import subprocess
    >>> proc=subprocess.Popen(["xfce4-terminal"])
    >>> #you should see the terminal is started...
    >>> proc.terminate()
    >>> #it is still there, alive and kicking...
    >>> import os
    >>> os.kill(proc.pid, 9) #let's try something more radical (SIGKILL)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ProcessLookupError: [Errno 3] No such process
    >>> # WTF???


    I was curious of this behaviour so I reproduced the issue in bash, it has nothing to do with Python's subprocess of course:

    (base) [matias@kashyyyk bec]$ xfce4-terminal &
    [1] 167148
    (base) [matias@kashyyyk bec]$ kill 167148
    bash: kill: (167148) - No such process


    (the terminal is still there)

    I am really puzzled. What's going on?

    Continue reading...

Compartilhe esta Página