From f7b44b5aabbe38a912d5b6af8c1b444ebc173ec8 Mon Sep 17 00:00:00 2001 From: Frederik <53608074+N0chteil@users.noreply.github.com> Date: Thu, 9 Mar 2023 16:45:23 +0100 Subject: [PATCH] fix: quitITunes function --- src/win32/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/win32/index.ts b/src/win32/index.ts index 9a8d9a9..1603ffd 100644 --- a/src/win32/index.ts +++ b/src/win32/index.ts @@ -1,5 +1,6 @@ import { AppleBridge } from "../index"; import { execSync } from "child_process"; +import { checkIfMusicRunning } from "../utils/checkIfMusicRunning"; import * as path from "path"; @@ -57,6 +58,14 @@ export function quitITunes() { try { console.log("[Win32][quitITunes]", "Killing iTunes"); execSync(`taskkill /F /IM "iTunes.exe"`); + + const checkIfRunningInt = setInterval(() => { + if (checkIfMusicRunning()) { + clearInterval(checkIfRunningInt); + + fetchAllInterval = setInterval(fetchAll, 1000); + } + }, 5000); } catch (e) { console.error("[Win32][quitITunes]", "Error killing iTunes:", e); }