Add Shell logging

This commit is contained in:
topjohnwu
2016-09-30 10:41:40 +08:00
parent 0f5465c5da
commit 62523c815e
4 changed files with 22 additions and 2 deletions
@@ -42,7 +42,7 @@ public class Shell {
}
rootSTDIN = new DataOutputStream(rootShell.getOutputStream());
rootSTDOUT = new StreamGobbler(rootShell.getInputStream(), rootOutList);
rootSTDOUT = new StreamGobbler(rootShell.getInputStream(), rootOutList, true);
rootSTDOUT.start();
List<String> ret = su("echo -BOC-", "id");
@@ -82,6 +82,7 @@ public class Shell {
for (String write : commands) {
STDIN.write((write + "\n").getBytes("UTF-8"));
STDIN.flush();
Logger.shell(false, write);
}
STDIN.write("exit\n".getBytes("UTF-8"));
STDIN.flush();
@@ -149,6 +150,7 @@ public class Shell {
for (String write : commands) {
STDIN.write((write + "\n").getBytes("UTF-8"));
STDIN.flush();
Logger.shell(true, write);
}
if (newShell) {
STDIN.write("exit\n".getBytes("UTF-8"));