Skip to content

Commit

Permalink
fix: update quitITunes function
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed Mar 9, 2023
1 parent ad006bc commit 9fc893d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/win32/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,18 @@ export function getPlayerState(): PlayerState {
}

export function quitITunes() {
fetchAllInterval.unref();
console.log("[Win32][quitITunes]", "Stopping fetch interval");
clearTimeout(fetchAllInterval);

setTimeout(() => execSync(`taskkill /F /IM "iTunes.exe"`), 2500);
console.log("[Win32][quitITunes]", "Killing iTunes in 3 seconds");
setTimeout(() => {
try {
console.log("[Win32][quitITunes]", "Killing iTunes");
execSync(`taskkill /F /IM "iTunes.exe"`);
} catch (e) {
console.error("[Win32][quitITunes]", "Error killing iTunes:", e);
}
}, 3000);
}

export function fetchITunes(type = "currentTrack"): TrackData {
Expand Down

0 comments on commit 9fc893d

Please sign in to comment.