-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Describe the problem you are trying to solve
Often enough I have cargo builds running in the background, and then I open up some entertainment while it finishes, but I often notice that my desktop is generally slow (no surprise, something is hammering the CPU in the background). I've began doing nice -n 20 bash -c "cargo build" (or something similar) recently, however, I still sometimes forget it and get frustrated to cancel the build and restart it with the (pretty verbose) nice prefix.
Describe the solution you'd like
Add a string/int nice config parameter to cargo.toml, under [build].
If int: An absolute value cargo has to attempt to set the nice value to on compilation threads/processes.
If string: A "relative" value (-2, +5) to try to set to on compilation threads/processes.
This setting is ignored on targets which don't support nice-esc prioritisation (windows comes to mind), though maybe a generic priority config value could be introduced which attempts to do this across many operating systems.
If the nice value is less than the current value, and the current running-as user has no privilege to bump down the nice value, then it could/should be ignored with a warning printed to stderr or stdout.