removed superfluous return code from spec
This commit is contained in:
parent
213d48c087
commit
88e745346e
4 changed files with 7 additions and 12 deletions
|
|
@ -101,14 +101,10 @@ public class JobServClient {
|
|||
int newProcess = this.api.sendNewJobMessage(command);
|
||||
switch(newProcess) {
|
||||
case -1:
|
||||
System.out.println(this.serversideTimeoutErrorMessage);
|
||||
System.out.println("Server failed to spawn process. Bad command.");
|
||||
break;
|
||||
|
||||
case -2:
|
||||
System.out.println("Server failed to create job, check server logs.");
|
||||
break;
|
||||
|
||||
case -3:
|
||||
// error logged by API Connector
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,9 +87,8 @@ class JobServClientAPIConnector {
|
|||
* sendNewJobMessage()
|
||||
* sends a shell command to the api server
|
||||
* returns new pid of job
|
||||
* or -1 if server thread couldnt synchronize before timeout
|
||||
* or -2 if server failed to create job
|
||||
* or -3 if client fails to connect
|
||||
* or -1 if server failed to create job
|
||||
* or -2 if client fails to connect
|
||||
*/
|
||||
public int sendNewJobMessage(String command) {
|
||||
// thought of escaping this, but the vulnerability is only client side, from client user input.
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ class ProcessManager {
|
|||
/*
|
||||
* newProcess()
|
||||
* Takes a command and returns the translated pid of a new process
|
||||
* Returns -1 if getLock fails TODO: REMOVE
|
||||
* Returns -2 if controller throws an IOException
|
||||
* Returns -1 if controller throws an IOException
|
||||
*/
|
||||
public int newProcess(String command) {
|
||||
|
||||
try {
|
||||
ProcessController newProc = new ProcessController(command);
|
||||
// we dont need to lock the map yet
|
||||
this.lockMap.put(newProc.getPid(), true);
|
||||
this.processMap.put(newProc.getPid(), newProc);
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ class ProcessManager {
|
|||
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldnt Spawn New Command: " + e.getMessage());
|
||||
return -2;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class ProcessManagerTest {
|
|||
@Test
|
||||
public void addProcessesTest() {
|
||||
int pid = manager.newProcess("sleep 1");
|
||||
assertNotEquals(-2, pid);
|
||||
assertNotEquals(-1, pid);
|
||||
|
||||
manager.shutdown();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue