Skip to content

Commit 159797a

Browse files
committed
Fix a bug where the stdout stream was getting closed before the Logger could read it
It was caused by me... lol
1 parent bb3fb2d commit 159797a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

app/src/main/java/ru/meefik/linuxdeploy/EnvUtils.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public static boolean exec(final Context c, final String shell, final List<Strin
202202
if (PrefStore.isDebugMode(c)) pb.redirectErrorStream(true);
203203
Process process = pb.start();
204204

205-
try (DataOutputStream os = new DataOutputStream(process.getOutputStream());
206-
InputStream stdout = process.getInputStream()) {
205+
try (DataOutputStream os = new DataOutputStream(process.getOutputStream())) {
206+
InputStream stdout = process.getInputStream(); // Gets closed by the logger
207207
// final InputStream stderr = process.getErrorStream();
208208

209209
// params.add(0, "LD_LIBRARY_PATH=" + PrefStore.getLibsDir(c) + ":$LD_LIBRARY_PATH");
@@ -212,14 +212,10 @@ public static boolean exec(final Context c, final String shell, final List<Strin
212212
params.add(0, "set -x");
213213
params.add("exit $?");
214214

215-
try {
216-
for (String cmd : params) {
217-
os.writeBytes(cmd + "\n");
218-
}
219-
os.flush();
220-
} catch (IOException e) {
221-
e.printStackTrace();
215+
for (String cmd : params) {
216+
os.writeBytes(cmd + "\n");
222217
}
218+
os.flush();
223219

224220
(new Thread() {
225221
@Override

0 commit comments

Comments
 (0)