You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Hiram Chirino (JIRA)" <ji...@apache.org> on 2009/09/01 04:35:33 UTC
[jira] Commented: (FELIX-1474) [gogo] result of commands is
implicitly written to pipe
[ https://issues.apache.org/jira/browse/FELIX-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12749737#action_12749737 ]
Hiram Chirino commented on FELIX-1474:
--------------------------------------
how about coupling the | syntax with an array like syntax to to setup the pipelines for each output type. For example:
% bundles | grep felix |[ result: echo , out:err: wc ]
basically that would allow you process the std out, std err, and result values of a command using 3 different commands or perhaps just 1.
> [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
> 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.