Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no sleep functionality #17

Open
Tracked by #1
NikolayJuly opened this issue Nov 8, 2023 · 0 comments
Open
Tracked by #1

Add no sleep functionality #17

NikolayJuly opened this issue Nov 8, 2023 · 0 comments

Comments

@NikolayJuly
Copy link
Owner

NikolayJuly commented Nov 8, 2023

Build takes a lot of time, we need to add functionality to avoid sleep.
But forth to consider sleep and display sleep are different things, so may be this is not needed of mac not going to sleep with desplay off

Can be done like this:

var assertionID: IOPMAssertionID = 0
        let assertResult = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep as CFString,
                                                       IOPMAssertionLevel(kIOPMAssertionLevelOn),
                                                       "Long runnign job" as CFString,
                                                       &assertionID)
        defer {
            IOPMAssertionRelease(assertionID)
        }

        logger.info("Requested system not to sleep with result \( assertResult == kIOReturnSuccess ? "success" : "failure" )")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant