From 8cbcb5075846f5a1f8e93ac08e86fc236758302a Mon Sep 17 00:00:00 2001 From: subframe7536 <1667077010@qq.com> Date: Wed, 18 Dec 2024 12:24:22 +0800 Subject: [PATCH] feat: speed up restart app on MacOS --- src/restart.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/restart.ts b/src/restart.ts index 84851b3..f1736f6 100644 --- a/src/restart.ts +++ b/src/restart.ts @@ -58,7 +58,13 @@ async function restartMacOS() { '-e', `quit app "${nameLong}"`, '-e', - 'delay 1', + 'repeat with i from 1 to 100', + '-e', + `if not (application "${nameLong}" is running) then exit repeat`, + '-e', + 'delay 0.1', + '-e', + 'end repeat', '-e', `do shell script quoted form of "${binary}"`, ],