From 19275d52fa89c18fff51f289d3e552959710e50a Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 26 Jan 2024 12:20:17 +0100 Subject: [PATCH] main: Fix Python traceback when Ctrl+C'ing a launched app --- src/powerprofilesctl.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/powerprofilesctl.in b/src/powerprofilesctl.in index 59b9fb3..0aafd9a 100755 --- a/src/powerprofilesctl.in +++ b/src/powerprofilesctl.in @@ -189,8 +189,11 @@ def _launch(args, profile, appid, reason): # print (f'Got {cookie} for {profile} hold') with subprocess.Popen(args) as launched_app: - launched_app.wait() - ret = launched_app.returncode + try: + launched_app.wait() + ret = launched_app.returncode + except KeyboardInterrupt: + ret = launched_app.returncode proxy.ReleaseProfile('(u)', cookie) return ret