File tree Expand file tree Collapse file tree 1 file changed +5
-24
lines changed
library/src/main/java/ashell/workers Expand file tree Collapse file tree 1 file changed +5
-24
lines changed Original file line number Diff line number Diff line change 12
12
* Copyright © 2017 All rights reserved.
13
13
*/
14
14
15
- /** todo old code, can be removed
16
- DataOutputStream writer;
17
- public void exec(List<String> commands) {
18
- onShellStateChanged(State.BUSY);
19
- if (writer == null) {
20
- writer = new DataOutputStream(process.getOutputStream());
21
- }
22
- try {
23
- writer.writeBytes(new String(StringUtils.listToString(commands).getBytes(Charset.forName("UTF-8"))));
24
- writer.writeBytes("\n");
25
- writer.flush();
26
- } catch (Exception e) {
27
- e.printStackTrace();
28
- }
29
- }
30
- */
31
-
32
15
public class ShellOutputStreamThread <T > extends Thread {
33
16
private Process process ;
34
17
private OutputStream outputStream ;
@@ -42,13 +25,11 @@ public ShellOutputStreamThread(Process process) {
42
25
43
26
@ Override
44
27
public void run () {
45
- synchronized (this ) {
46
- while (true ) {
47
- try {
48
- this .wait ();
49
- } catch (InterruptedException e ) {
50
- e .printStackTrace ();
51
- }
28
+ while (true ) {
29
+ try {
30
+ process .waitFor ();
31
+ } catch (InterruptedException e ) {
32
+ e .printStackTrace ();
52
33
}
53
34
}
54
35
}
You can’t perform that action at this time.
0 commit comments