From 5bb94ece79ceeb409f656352ed2e5623f7b32185 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sun, 5 Oct 2025 23:13:59 -0700 Subject: [PATCH] Don't hang if ffmpeg exits on its own --- srec.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/srec.py b/srec.py index 50f311c..e905483 100644 --- a/srec.py +++ b/srec.py @@ -8,6 +8,7 @@ from dataclasses import dataclass from datetime import datetime import os import subprocess +import sys from typing import Any, Callable import gi @@ -25,8 +26,11 @@ class Recording: def stop(self) -> None: stdin = self.process.stdin assert stdin is not None - stdin.write(b'q') - stdin.flush() + try: + stdin.write(b'q') + stdin.flush() + except BrokenPipeError: + print("Stream already stopped?", file=sys.stderr) self.process.wait() -- 2.50.1