Skip to content

Shutdown gracefully on SIGHUP #51

@hholst80

Description

@hholst80

There are additional signals that should be catched by the application and shutdown the stream gracefully. I managed to get this error again by spawning wl-screenrec in the background and then killing the terminal. I think this should signal, at least on Linux, a SIGHUP to the application.

# mpv screenrecord.mp4 
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
Failed to recognize file format.
import signal
import time

signals = [
    signal.SIGABRT,
    signal.SIGFPE,
    signal.SIGILL,
    signal.SIGINT,
    signal.SIGHUP,
    signal.SIGSEGV,
    signal.SIGTERM,
]


def sighand(signum, frame):
    with open('sighand.txt', 'a') as f:
        signame = signal.Signals(signum).name
        f.write(f"signum={signum} ({signame})\n")


for sig in signals:
    signal.signal(sig, sighand)


time.sleep(3600)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions