kobo / groovyserv

Groovy's startup acceralator.
http://kobo.github.io/groovyserv/
Other
98 stars 10 forks source link

piping with trailing < source #10

Closed Dierk closed 7 years ago

Dierk commented 14 years ago

on the command shell (OS X Terminal) the following works cat data.txt | groovyclient -e "println System.in.text" but the following equivalent does not groovyclient -e "println System.in.text" < data.txt

it's by no means a showstopper but since groovyserv makes command-line scripting with groovy so crispy, it would be good if supporting this scenario would be possible

uehaj commented 14 years ago

thank you for reporting. I tried it but i can't repro consistently. but once i get:

$ groovyclient -e "println System.in.text" < test.txt Caught: java.io.IOException: Write end dead at org.jggug.kobo.groovyserv.StreamRequestInputStream.read(StreamRequestInputStream.groovy:40) at script_from_command_line.run(script_from_command_line:1) at org.jggug.kobo.groovyserv.GroovyInvokeHandler.invokeGroovy(GroovyInvokeHandler.groovy:80) at org.jggug.kobo.groovyserv.GroovyInvokeHandler.this$2$invokeGroovy(GroovyInvokeHandler.groovy) at org.jggug.kobo.groovyserv.GroovyInvokeHandler.run(GroovyInvokeHandler.groovy:47)

is this same problem? I have experienced this message sometimes in Linux environment where relatively slow CPU power(under Virtual BOX). In there, it is occurred not only when use redirect (<) but use pipe(|).

Dierk commented 14 years ago

yep, you are right. When trying a number of times, it now works most of the time both ways. I should have tested it more thoroughly. It is not a functional issue in groovyserv. Sorry for the noise.

uehaj commented 14 years ago

thank you your information. So this is more generic problem and more important. (It could stop the show.) we'd like to fix in future release. thx

nobeans commented 7 years ago

I've confirmed this but it seems alread be fixed.

$ cat data.txt
hello
foo
bar
this is end.

$ cat data.txt | groovyclient -e "println System.in.text"
hello
foo
bar
this is end.

$ groovyclient -e "println System.in.text" < data.txt
hello
foo
bar
this is end.

$ groovyclient -v
Groovy Version: 2.4.8 JVM: 1.8.0_111 Vendor: Oracle Corporation OS: Mac OS X
GroovyServ Version: Server: 1.1.0
GroovyServ Version: Client: 1.1.0