For Programmers: Free Programming Magazines  


Home > Archive > Tcl > June 2006 > child killed: write on pipe with no readers









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author child killed: write on pipe with no readers
sai.kaki@gmail.com

2006-06-27, 10:00 pm

Hi All,

I am using the the following command inside tcl interpreter
------------code
set ret [catch {exec lynx -dump
http://wwwin.sima.com/cgi-bin/edcs/...LUE=EDCS-506823}
message]
error_form " *********ret=$ret**********message=$mess
age*****"
--------------

and gives the following error:
*********ret=1**********message=child killed: write on pipe with no
readers*****

My aim is to run a getedcs.cgi script and get the output using the lynx
dump option.
This command works fine when executed from the unix command line or
when invoked from tclsh shell.

Any ideas of why i am hitting this error and how to get around? Would
appreciate if someone can at least point me in the right direction.

Thanks in advance,
Sai.

Arjen Markus

2006-06-28, 4:02 am


sai.kaki@gmail.com schreef:

> Hi All,
>
> I am using the the following command inside tcl interpreter
> ------------code
> set ret [catch {exec lynx -dump
> http://wwwin.sima.com/cgi-bin/edcs/...LUE=EDCS-506823}
> message]
> error_form " *********ret=$ret**********message=$mess
age*****"
> --------------
>
> and gives the following error:
> *********ret=1**********message=child killed: write on pipe with no
> readers*****
>
> My aim is to run a getedcs.cgi script and get the output using the lynx
> dump option.
> This command works fine when executed from the unix command line or
> when invoked from tclsh shell.
>
> Any ideas of why i am hitting this error and how to get around? Would
> appreciate if someone can at least point me in the right direction.
>
> Thanks in advance,
> Sai.


If you run the command interactively, then there is a program that
reads
the data from the standard output of the command. Apparently it is
not directing the output to just "standard output", but to a pipe -
well, that is my interpretation of the error message.

My suggestion to solve it: use something along these lines:

set infile [open "|lynx ..." r]
fileevent readable $infile [list getlynx $infile]
fconfigure $infile -buffer line

proc getlynx {input} {
... read a line of input
... on end-of-file: set ::forever 1
}

vwait forever

Actual coding examples can be found on the Wiki

Regards,

Arjen

Ralf Fassel

2006-06-28, 7:03 pm

* sai.kaki@gmail.com
| I am using the the following command inside tcl interpreter
--<snip-snip>--
| This command works fine when executed from the unix command line or
| when invoked from tclsh shell.

What is the difference between the TCL interpreter and the tclsh?

R'
Cameron Laird

2006-06-28, 7:03 pm

In article <1151476490.881726.108420@75g2000cwc.googlegroups.com>,
Arjen Markus <arjen.markus@wldelft.nl> wrote:[color=darkred]
>
>sai.kaki@gmail.com schreef:
>
>http://wwwin.sima.com/cgi-bin/edcs/...LUE=EDCS-506823}
Ralf Fassel

2006-06-28, 10:01 pm

* "Arjen Markus" <arjen.markus@wldelft.nl>
| set infile [open "|lynx ..." r]
| fileevent readable $infile [list getlynx $infile]
| fconfigure $infile -buffer line
|
| proc getlynx {input} {
| ... read a line of input
| ... on end-of-file: set ::forever 1
| }
|
| vwait forever

Shouldn't that be equivalent to 'exec', since 'exec' returns the
stdout of the command as result?

man exec(n)
If standard output has not been redirected then the exec command
returns the standard output from the last command in the pipeline.

It seems to me that some info is missing here. Either 'exec' isn't
'exec', or the main program is not tclsh, or lynx isn't plain lynx,
but some wrapper which fiddles with its stdout. Or...

R'
sai.kaki@gmail.com

2006-06-29, 4:03 am

Thanks guys for the promp answers. Thanks for the detailed explanation.

I tried the method suggested by Arjen but couldnt get it to work.

Cameron Laird-- Regarding 2) I am using "lynx -dump" actually. 4) When
i execute "exec sh -c lynx -dump <.......cgi>" the command is hanging
for ever. I dont see any response from the command 6) I tried with
"wget" but all i get is connectioin refused. 7) Well the webserver is
internal webserver so thats the reason why you were not able to connect
to it.

Any ideas?

Thanks,
Sai.

Ralf Fassel wrote:
> * "Arjen Markus" <arjen.markus@wldelft.nl>
> | set infile [open "|lynx ..." r]
> | fileevent readable $infile [list getlynx $infile]
> | fconfigure $infile -buffer line
> |
> | proc getlynx {input} {
> | ... read a line of input
> | ... on end-of-file: set ::forever 1
> | }
> |
> | vwait forever
>
> Shouldn't that be equivalent to 'exec', since 'exec' returns the
> stdout of the command as result?
>
> man exec(n)
> If standard output has not been redirected then the exec command
> returns the standard output from the last command in the pipeline.
>
> It seems to me that some info is missing here. Either 'exec' isn't
> 'exec', or the main program is not tclsh, or lynx isn't plain lynx,
> but some wrapper which fiddles with its stdout. Or...
>
> R'


Cameron Laird

2006-06-29, 8:01 am

In article <1151572458.124738.312010@b68g2000cwa.googlegroups.com>,
<sai.kaki@gmail.com> wrote:
>Thanks guys for the promp answers. Thanks for the detailed explanation.
>
> I tried the method suggested by Arjen but couldnt get it to work.
>
>Cameron Laird-- Regarding 2) I am using "lynx -dump" actually. 4) When
>i execute "exec sh -c lynx -dump <.......cgi>" the command is hanging
>for ever. I dont see any response from the command 6) I tried with
>"wget" but all i get is connectioin refused. 7) Well the webserver is
>internal webserver so thats the reason why you were not able to connect
>to it.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com