removed superfluous return code from spec

This commit is contained in:
Aidan Hahn 2019-05-23 22:38:39 -07:00
parent 213d48c087
commit 88e745346e
No known key found for this signature in database
GPG key ID: 327711E983899316
4 changed files with 7 additions and 12 deletions

View file

@ -101,14 +101,10 @@ public class JobServClient {
int newProcess = this.api.sendNewJobMessage(command); int newProcess = this.api.sendNewJobMessage(command);
switch(newProcess) { switch(newProcess) {
case -1: case -1:
System.out.println(this.serversideTimeoutErrorMessage); System.out.println("Server failed to spawn process. Bad command.");
break; break;
case -2: case -2:
System.out.println("Server failed to create job, check server logs.");
break;
case -3:
// error logged by API Connector // error logged by API Connector
break; break;

View file

@ -87,9 +87,8 @@ class JobServClientAPIConnector {
* sendNewJobMessage() * sendNewJobMessage()
* sends a shell command to the api server * sends a shell command to the api server
* returns new pid of job * returns new pid of job
* or -1 if server thread couldnt synchronize before timeout * or -1 if server failed to create job
* or -2 if server failed to create job * or -2 if client fails to connect
* or -3 if client fails to connect
*/ */
public int sendNewJobMessage(String command) { public int sendNewJobMessage(String command) {
// thought of escaping this, but the vulnerability is only client side, from client user input. // thought of escaping this, but the vulnerability is only client side, from client user input.

View file

@ -63,13 +63,13 @@ class ProcessManager {
/* /*
* newProcess() * newProcess()
* Takes a command and returns the translated pid of a new process * Takes a command and returns the translated pid of a new process
* Returns -1 if getLock fails TODO: REMOVE * Returns -1 if controller throws an IOException
* Returns -2 if controller throws an IOException
*/ */
public int newProcess(String command) { public int newProcess(String command) {
try { try {
ProcessController newProc = new ProcessController(command); ProcessController newProc = new ProcessController(command);
// we dont need to lock the map yet
this.lockMap.put(newProc.getPid(), true); this.lockMap.put(newProc.getPid(), true);
this.processMap.put(newProc.getPid(), newProc); this.processMap.put(newProc.getPid(), newProc);
@ -78,7 +78,7 @@ class ProcessManager {
} catch (IOException e) { } catch (IOException e) {
System.err.println("Couldnt Spawn New Command: " + e.getMessage()); System.err.println("Couldnt Spawn New Command: " + e.getMessage());
return -2; return -1;
} }
} }

View file

@ -48,7 +48,7 @@ public class ProcessManagerTest {
@Test @Test
public void addProcessesTest() { public void addProcessesTest() {
int pid = manager.newProcess("sleep 1"); int pid = manager.newProcess("sleep 1");
assertNotEquals(-2, pid); assertNotEquals(-1, pid);
manager.shutdown(); manager.shutdown();
} }