Rework and document OS class

This commit is contained in:
DaCool
2023-11-12 13:57:18 +00:00
committed by harlekin
parent 1ef0b2f4b7
commit d2b9985be8
5 changed files with 89 additions and 29 deletions

View File

@@ -73,7 +73,7 @@ public class Linux extends OS {
}
List<String> actual_command = command;
if (checkNiceAvailability()) {
if (isNiceAvailable()) {
// launch the process in lowest priority
if (env_overight != null) {
actual_command.add(0, env_overight.get("PRIORITY"));
@@ -109,7 +109,7 @@ public class Linux extends OS {
);
}
@Override public boolean getSupportHighPriority() {
@Override public boolean isHighPrioritySupported() {
try {
ProcessBuilder builder = new ProcessBuilder();
builder.command("bash", "-c", ID_COMMAND_INVOCATION);
@@ -123,7 +123,7 @@ public class Linux extends OS {
if ((userLevel = reader.readLine()) != null) {
// Root user in *ix systems -independently of the alias used to login- has a id value of 0. On top of being a user with root capabilities,
// to support changing the priority the nice tool must be accessible from the current user
return (userLevel.equals("0")) & checkNiceAvailability();
return (userLevel.equals("0")) & isNiceAvailable();
}
}
catch (IOException e) {
@@ -133,7 +133,7 @@ public class Linux extends OS {
return false;
}
@Override public boolean checkNiceAvailability() {
@Override public boolean isNiceAvailable() {
ProcessBuilder builder = new ProcessBuilder();
builder.command(NICE_BINARY_PATH);
builder.redirectErrorStream(true);