[ 
https://issues.apache.org/jira/browse/FELIX-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Derek Baum resolved FELIX-1474.
-------------------------------

    Resolution: Fixed

This behaviour can now be disabled by setting the session variable 
.FormatPipe=false

> [gogo] result of commands is implicitly written to pipe
> -------------------------------------------------------
>
>                 Key: FELIX-1474
>                 URL: https://issues.apache.org/jira/browse/FELIX-1474
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo
>            Reporter: Derek Baum
>            Assignee: Derek Baum
>            Priority: Minor
>
> RFC132 commands are designed to be easy to create, allowing direct use of 
> System.out
> void echo1(String[] args) {
>     StrinbgBuilder buf = new StringBuilder();
>     for (String arg : args) {
>         if (buf.length() > 0)
>             buf.append(' ');
>         buf.append(arg)
>     }
>     System.out.println(buf.toString());
> }
> but it also allows commands that return values:
> String echo2(String[] args) {
>     StrinbgBuilder buf = new StringBuilder();
>     for (String arg : args) {
>         if (buf.length() > 0)
>             buf.append(' ');
>         buf.append(arg)
>     }
>     return(buf.toString());
> }
> Both these command cause grep to match 'hello':
> % echo1 hello | grep hello
> % echo2 hello | grep hello
> This is expected with echo1, as it writes to System.out.
> It is more surprising that echo2 also works, as it doesn't write to 
> System.out.
> In this case, the runtime is implicitly writing the result of 'echo2 hello' 
> into the pipe.
> This is convenient, as it lets commands that don't write to System.out be 
> used in pipelines.
> However, it can also get in the way.
> I have a grep command that writes to System.out and returns a boolean, 
> depending on whether it matched:
> % bundles | grep felix | wc
> but in this case, the wc command gets the output from grep and also the 
> result of grep (true)  which not wanted,
> so I would like some way of disabling this behaviour.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to