Thank Jesse . Meanwhile i tried something like . created a 
ListenerLogDecorator  class which extends LineTransformationOutputStream 
and in the perform method i called it like below 

ListenerLogDecorator outStream = new ListenerLogDecorator(listener);
 
launcher.launch().pwd(workspace).cmds(constructDefaultMatlabCommand()).stderr(outStream).join();

the decorator class contains one overridden method like below. 

  protected void eol(byte[] bytes, int length) throws IOException {
        if(this.listener == null){
            return;
        }
        String line = new String(bytes,0,length,Charset.defaultCharset());
        this.listener.write(line.getBytes(Charset.defaultCharset()));     
    } 


This solution is working for me but please suggest if i am on right track 

On Monday, 8 October 2018 19:48:06 UTC+5:30, Jesse Glick wrote:
>
> On Sun, Oct 7, 2018 at 3:30 AM Nikhil Bhoski <nikhil...@gmail.com 
> <javascript:>> wrote: 
> > i want to keep error strem and send that to listener 
>
> That is what happens by default. I thought you said the program prints 
> the same message to both stdout and stderr, in which case `.stderr(new 
> NullOutputStream())` would work around the bug. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/aaa25990-95e7-42cd-af0f-df64d1fce144%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to