On linux, only the root can create process with high priority, so don't display the option is the client is launched as regular user
This commit is contained in:
@@ -167,6 +167,19 @@ public class Linux extends OS {
|
||||
return builder.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSupportHighPriority() {
|
||||
// only the root user can create process with high (negative nice) value
|
||||
String logname = System.getenv("LOGNAME");
|
||||
String user = System.getenv("USER");
|
||||
|
||||
if ((logname != null && logname.equals("root")) || (user != null && user.equals("root"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void checkNiceAvailability() {
|
||||
ProcessBuilder builder = new ProcessBuilder();
|
||||
builder.command(NICE_BINARY_PATH);
|
||||
|
||||
@@ -37,6 +37,10 @@ public abstract class OS {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getSupportHighPriority() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Process exec(List<String> command, Map<String, String> env) throws IOException {
|
||||
ProcessBuilder builder = new ProcessBuilder(command);
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
Reference in New Issue
Block a user