Kaynağa Gözat

Using processbuilder

Brian He 6 yıl önce
ebeveyn
işleme
3b5226b056
1 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 8
    3
      Client/src/main/java/SimpleShell.java

+ 8
- 3
Client/src/main/java/SimpleShell.java Dosyayı Görüntüle

@@ -99,7 +99,7 @@ public class SimpleShell {
99 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 103
                     StringBuilder message = new StringBuilder();
104 104
                     String github = list.get(1);
105 105
                     for(int i = 2; i < list.size(); i++) {
@@ -116,7 +116,7 @@ public class SimpleShell {
116 116
                     webber.MakeURLCall("/ids/" + github + "/messages", "POST", messageToString);
117 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 120
                     StringBuilder message = new StringBuilder();
121 121
                     String fromid = list.get(1);
122 122
                     String toid = list.get(list.size() - 1);
@@ -149,7 +149,12 @@ public class SimpleShell {
149 149
                 }
150 150
 
151 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 159
                 //obtain the input stream
155 160
                 InputStream is = process.getInputStream();