Skip to content

Commit

Permalink
fix: only attempt to acquire wakelock on macos (#189)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Dahan <[email protected]>
Co-authored-by: Jeremy Rose <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2023
1 parent 3b770c3 commit 6c9b463
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ export function startServer(port: number, device: string | null = null, enableCo

const begin = Date.now();
let wakeLock: any;
try {
wakeLock = new WakeLock("saxi plotting");
} catch (e) {
console.warn("Couldn't acquire wake lock. Ensure your machine does not sleep during plotting");
// The wake-lock module is macOS-only.
if (process.platform === 'darwin') {
try {
wakeLock = new WakeLock("saxi plotting");
} catch (e) {
console.warn("Couldn't acquire wake lock. Ensure your machine does not sleep during plotting");
}
}

try {
Expand Down

0 comments on commit 6c9b463

Please sign in to comment.