How do I know if a process is running?

Cocoa MacOS. I am starting a proccess but the .isRunning feature doesn't seem to work for me. The proccess can fail and .isRunning will still return true in multiple cases. Is there any way to get other data about the proccess that can help me determine if it is active or not? The proccess is a cryptominer, so its cpu intensive. If i could return the cpu usage of the proccess, I could determine if it is running or not. Does anyone know how I might do this? Thanks so mcuh for your time!

Replies

I am starting a [process]

How are you starting the process? As a child process using Swift’s

Process
API? Or something else?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, that is correct.

Yes, that is correct.

I asked three questions. I’m presuming that the “correct” one is the one that asked whether you’re using

Process
.

In that case, the easiest way to learn about the process terminating is by setting a

terminationHandler
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"