-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVerify.java
48 lines (37 loc) · 1.47 KB
/
Verify.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.io.*;
class Verify {
private String probstr;
private String uiLoc;
Verify(String p, String floc) { //constructor
this.uiLoc = floc;
this.probstr = p;
}
/*TODO This currently does not work correctly
currently when run it returns:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
which is the text found at the top of the command prompt
It does this for any command I try to run and I don't know why it doesn't work
Couldn't find anyone online having similar problems
*/
String getSolvable() {
String cmd = "cd " + uiLoc + " && node proplog.js \"" + probstr + "\"";
//run command prompt and run cmd command
ProcessBuilder pb = new ProcessBuilder("cmd.exe", cmd);
StringBuilder outstream = new StringBuilder();
try { //collect the output from the command prompt
Process p = pb.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
OutputStream ost = p.getOutputStream();
while(!(line = r.readLine()).equals("")) {
outstream.append(line).append("\n");
}
r.close();
ost.close();
} catch (IOException e) {
e.printStackTrace();
}
return outstream.toString();
}
}