How to change process title in Swift on Linux?

179 Views Asked by At

Python: setproctitle How to do the same thing in Swift?

1

There are 1 best solutions below

1
Caleb Kleveter On

You can mutate that ProcessInfo.processName property:

ProcessInfo.processInfo.processName = "New Name"

The documentation for this property does give this warning

User defaults and other aspects of the environment might depend on the process name, so be very careful if you change it. Setting the process name in this manner is not thread safe.