mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Make dhclient not block (#187)
This commit is contained in:
@@ -100,7 +100,7 @@ public class NetworkManager {
|
||||
if (!config.staticIp.equals("")) {
|
||||
shell.executeBashCommand("ip addr del " + config.staticIp + "/8 dev eth0");
|
||||
}
|
||||
shell.executeBashCommand("dhclient eth0");
|
||||
shell.executeBashCommand("dhclient eth0", false);
|
||||
} catch (Exception e) {
|
||||
logger.error("Exception while setting DHCP!");
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@ public class ShellExec {
|
||||
this.readError = readError;
|
||||
}
|
||||
|
||||
public int executeBashCommand(String command) throws IOException {
|
||||
return executeBashCommand(command, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a bash command. We can handle complex bash commands including multiple executions (; |
|
||||
* and ||), quotes, expansions ($), escapes (\), e.g.: "cd /abc/def; mv ghi 'older ghi '$(whoami)"
|
||||
@@ -46,10 +50,9 @@ public class ShellExec {
|
||||
* @param command Bash command to execute
|
||||
* @return true if bash got started, but your command may have failed.
|
||||
*/
|
||||
public int executeBashCommand(String command) throws IOException {
|
||||
public int executeBashCommand(String command, boolean wait) throws IOException {
|
||||
logger.debug("Executing \"" + command + "\"");
|
||||
|
||||
boolean wait = true;
|
||||
boolean success = false;
|
||||
Runtime r = Runtime.getRuntime();
|
||||
// Use bash -c so we can handle things like multi commands separated by ; and
|
||||
|
||||
Reference in New Issue
Block a user