Skip to content

Commit

Permalink
getMacOSVersion: replace Deno.run with Deno.Command
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Jun 9, 2023
1 parent 99a06b8 commit c394bc1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions music-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ async function main() {
// macOS/JXA functions

async function getMacOSVersion(): Promise<number> {
const proc = Deno.run({
cmd: ["sw_vers", "-productVersion"],
stdout: "piped",
});
const rawOutput = await proc.output();
proc.close();
const output = new TextDecoder().decode(rawOutput);
const version = parseFloat(output.match(/\d+\.\d+/)![0]);
const cmd = new Deno.Command("sw_vers", { args: ["-productVersion"] });
const output = await cmd.output();
const decoded = new TextDecoder().decode(output.stdout);
const version = parseFloat(decoded.match(/\d+\.\d+/)![0]);
return version;
}

Expand Down

0 comments on commit c394bc1

Please sign in to comment.