aboutsummaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-11-16 12:13:58 +0000
committerliamfallon <liam.fallon@est.tech>2020-11-16 14:48:56 +0000
commit17527ee82c63b8671224b3340e379e0bfcce6ba1 (patch)
tree1175bd21681b98d9e4a7575323bf4ca0b1660511 /auth
parent90bc246ffec30f7d97474d772d8bad73715cdd45 (diff)
Apex CLI editor closes standard input/output/error
The Apex CLI editor closes its input and output when it completes. This is correct behaviour when the input and output are files. However, if the input and output are tied to standard input, output, and error then if there are subsequent actions in the JVM (Such as continuing to run Apex as we do in tests), then any output such as logging is lost. This fix checks for standard input/output/error before closing the input and output. Issue-ID: POLICY-2897 Change-Id: Ifa20b62511f770197f30c4a817212a92876dd6a6 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'auth')
-rw-r--r--auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java
index 3adea1a89..991257e6b 100644
--- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java
+++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorLoop.java
@@ -131,8 +131,15 @@ public class CommandLineEditorLoop {
}
}
- reader.close();
- writer.close();
+ writer.flush();
+
+ if (!System.in.equals(inputStream)) {
+ reader.close();
+ }
+
+ if (!System.out.equals(outputStream) && !System.err.equals(outputStream)) {
+ writer.close();
+ }
return executionStatus.getRight();
}