[
https://issues.apache.org/jira/browse/KARAF-7741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765136#comment-17765136
]
Aishani commented on KARAF-7741:
--------------------------------
Hi [~jbonofre] ,
Please refer the below information. If anything else is required please let me
know.
{*}Title{*}: *Commands like scr:list and ls giving null response remotely from
karaf environment.*
{*}Environment{*}: Karaf 4.2.x or 4.3.x or 4.4.x version , OS - Mac OS or
Windows
{*}Description{*}:Trying to fire an API which would fetch the response of
running a command in Karaf environment, remotely. Using SessionFactory and
session Object. The commands run are from the karafgogoshell library.
{*}Code logic used{*}:
This is the logic used to run the command:
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
final PrintStream errStream = new PrintStream(errBaos, true);
final PrintStream outStream = new PrintStream(baos);
final Session session = sessionFactory.create(System.{_}in{_}, outStream,
errStream);
try {
Object execute = session.execute(commandLine);
outStream.flush();
response = baos.toString();
} catch (Throwable e) {
e.printStackTrace(errStream);
response = errBaos.toString() + errBaos.toString();
} finally {
{_}closeQuietly{_}(baos, errBaos);
session.close();
}
> scr commands not working remotely with Session Object in karaf
> --------------------------------------------------------------
>
> Key: KARAF-7741
> URL: https://issues.apache.org/jira/browse/KARAF-7741
> Project: Karaf
> Issue Type: Bug
> Components: karaf
> Affects Versions: 4.2.15
> Environment: Karaf 2.4.15
> Running commands remotely. Using Session and SessionFactory object.
> Reporter: Aishani
> Assignee: Jean-Baptiste Onofré
> Priority: Blocker
> Fix For: 4.2.15
>
>
> Trying to run commands like ls, scr and bundle commands remotely using the
> session object implementation of karaf. The implementation includes hitting
> an API with required parameters and command required to be run. The response
> received should give the exact response that we should we if get when we run
> the command from within karaf shell using command line. The bundle commands
> are giving correct response. However, the scr and ls commands are not giving
> any response, getting an empty array as a response.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)