Hi,

Yes, Pax Shell does "strange" things with system streams in order to
support the upcoming Thread IO service (4.2 draft specs).
But I never encountered your situation. It may be good if you upload
the code somewhere so I can test/debug. Maybe your own laboratory at
ops4j?

On Fri, Mar 27, 2009 at 3:10 PM, Sebastien Braun <b...@yellowhippy.com> wrote:
> Hi all,
>
> first, thank you to all OPS4J contributors, I really appreciate your
> work!
>
> I have written a little helper library that uses ASM to generate OSGi
> Command Provider implementations for Felix Shell commands. (If you are
> interested, I'd be willing to donate the code, together with an Equinox
> Shell -> OSGi Shell adapter I'm working on).
>
> But if I try to use pipes on the shell prompt, like this:
>
> $ felix:ps | grep manager
>
> it works the first time, and nothing happens the second time.
>
> JConsole shows the following threads:
>
>        Name: pipe-[felix:ps]
>        State: TIMED_WAITING on java.io.pipedinputstr...@7eb1fea4
>        Total blocked: 0  Total waited: 254
>        Stack trace:
>        java.lang.Object.wait(Native Method)
>        java.io.PipedInputStream.awaitSpace(PipedInputStream.java:274)
>        java.io.PipedInputStream.receive(PipedInputStream.java:232)
>        java.io.PipedOutputStream.write(PipedOutputStream.java:149)
>        java.io.PrintStream.write(PrintStream.java:447)
>           - locked java.io.printstr...@6469cee6
>        
> org.ops4j.pax.shell.threadio.internal.ThreadPrintStream.write(ThreadPrintStream.java:64)
>        <snip>
>
>        Name: pipe-[grepo]
>        State: BLOCKED on
>        org.ops4j.pax.shell.threadio.internal.threadprintstr...@7a6bb93c
>        owned by: pipe-[felix:ps]
>        Total blocked: 1  Total waited: 0
>        Stack trace:
>        java.io.PrintStream.println(PrintStream.java:773)
>        
> org.ops4j.pax.shell.runtime.internal.provider.ToolsCommandProvider.grep(ToolsCommandProvider.java:64)
>        <snip>
>
> which looks like a deadlock to me. I looked at the code, but didn't find
> an (obvious) problem with it.
>
> My adapter code essentially does the following:
>
> public void execute(String[] args) {
>    StringBuilder arguments = new StringBuilder(m_command.getName());
>    if (args != null) {
>        for (String arg : args)
>            arguments.append(' ').append(arg);
>    }
>
>    final String commandline = arguments.toString();
>    if (commandline.equals(m_command.getName() + " --usage"))
>        System.out.println(m_command.getUsage());
>    else
>        m_command.execute(commandline, System.out, System.err);
> }
>
> Is this a problem with my usage of the system streams, or does pax-shell
> do something strange? Any pointers?
>
> Thanks,
> Sébastien
>
> _______________________________________________
> general mailing list
> general@lists.ops4j.org
> http://lists.ops4j.org/mailman/listinfo/general
>
>



-- 
Alin Dreghiciu
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.
http://www.qi4j.org - New Energy for Java - Domain Driven Development.
Looking for a job.
Sent from: Cluj-Napoca CJ Romania.

_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to