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
signature.asc
Description: This is a digitally signed message part
_______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
