finished part 1

This commit is contained in:
Flavien Haas 2020-12-08 20:16:45 +00:00
parent 089b6a04d0
commit db4cdcca54
3 changed files with 18 additions and 9 deletions

Binary file not shown.

Binary file not shown.

View File

@ -9,17 +9,26 @@ public class AProcess {
// args is the command
ProcessBuilder pb = new ProcessBuilder(args);
Process process = pb.start();
// obtain the input and output streams
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
try {
Process process = pb.start();
// obtain the input and output streams
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ( (line = br.readLine()) != null)
System.out.println(line);
br.close();
} catch (IOException e) {
System.out.println(e);
}
String line;
while ( (line = br.readLine()) != null)
System.out.println(line);
br.close();
}
}