Browse Source

Using processbuilder

Brian He 6 years ago
parent
commit
3b5226b056
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      Client/src/main/java/SimpleShell.java

+ 8
- 3
Client/src/main/java/SimpleShell.java View File

99
                     continue;
99
                     continue;
100
                 }
100
                 }
101
 
101
 
102
-                if(list.contains("send") && list.size() > 2 && !list.get(list.size() - 2).equals("to")) {
102
+                if(list.contains("send") && list.size() > 2 && !list.get(list.size() - 2).equals("to") && !list.get(list.size() - 3).contains("\'")) {
103
                     StringBuilder message = new StringBuilder();
103
                     StringBuilder message = new StringBuilder();
104
                     String github = list.get(1);
104
                     String github = list.get(1);
105
                     for(int i = 2; i < list.size(); i++) {
105
                     for(int i = 2; i < list.size(); i++) {
116
                     webber.MakeURLCall("/ids/" + github + "/messages", "POST", messageToString);
116
                     webber.MakeURLCall("/ids/" + github + "/messages", "POST", messageToString);
117
                     continue;
117
                     continue;
118
                 }
118
                 }
119
-                if(list.contains("send") && list.get(list.size() - 2).equals("to")) {
119
+                if(list.contains("send") && list.get(list.size() - 2).equals("to") && list.get(list.size() - 3).contains("\'")) {
120
                     StringBuilder message = new StringBuilder();
120
                     StringBuilder message = new StringBuilder();
121
                     String fromid = list.get(1);
121
                     String fromid = list.get(1);
122
                     String toid = list.get(list.size() - 1);
122
                     String toid = list.get(list.size() - 1);
149
                 }
149
                 }
150
 
150
 
151
                 // wait, wait, what curiousness is this?
151
                 // wait, wait, what curiousness is this?
152
-                Process process = pb.start();
152
+                Process process = null;
153
+                try {
154
+                    process = pb.start();
155
+                } catch(IOException e) {
156
+                    e.printStackTrace();
157
+                }
153
 
158
 
154
                 //obtain the input stream
159
                 //obtain the input stream
155
                 InputStream is = process.getInputStream();
160
                 InputStream is = process.getInputStream();