You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2021/05/06 09:01:21 UTC
[karaf] branch main updated: [KARAF-7133] Allow karaf commands to
have return codes
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/main by this push:
new c9b5c34 [KARAF-7133] Allow karaf commands to have return codes
new 54febab Merge pull request #1361 from seeburger-ag/topic/KARAF-7133
c9b5c34 is described below
commit c9b5c343d0ad5c0e1fc7b95b14b79ef748908821
Author: Johannes Utzig <j....@seeburger.de>
AuthorDate: Thu Apr 1 11:59:53 2021 +0200
[KARAF-7133] Allow karaf commands to have return codes
only print out results if they are not integers. If they are integers,
they should are treated as exit codes.
---
.../java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index b4af472..9878f07 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -465,7 +465,7 @@ public class ConsoleSessionImpl implements Session {
private void doExecute(CharSequence command) {
try {
Object result = session.execute(command);
- if (result != null) {
+ if (result != null && !(result instanceof Integer)) {
session.getConsole().println(session.format(result, Converter.INSPECT));
}
} catch (InterruptedException e) {