On Sat, 2003-10-25 at 06:40, Kostas Oikonomou wrote:
> (If you receive this twice, please excuse the double post. I'm straightening out
> some trouble
> with my subscription to the list.)
>
> I'm having some problems with pipes on Solaris.
> Here is a very simple example, the tests/posix/spawn.icn program:
>
> procedure main()
> L := pipe() | stop("Couldn't open pipe: ", &errortext)
> system("/bin/ls -l test-dir &", , L[2])
> system("/bin/cat -n &", L[1])
> close(L[1])
> close(L[2])
> write("everything written to pipe.")
> delay(1000)
> end
>
> This produces:
>
> bash-2.05$ ./spawn
> everything written to pipe.
> bash-2.05$
>
> No output from "cat".
>
> Can anyone else verify/replicate this problem?
> My unicon is compiled from CVS as of two days ago.
I can verify that this works the same way under Linux,
and appears to be a combination of problems. The
following rewrite works:
procedure main()
L := pipe() | stop("Couldn't open pipe: ", &errortext)
system("/bin/ls -l test-dir &", , L[2])
write("everything written to pipe.")
close(L[2])
system("cat ", L[1], &output)
close(L[1])
end
There are two changes that are significant:
(1) The second system does not work if the command
is run in the background, so I assume the act
of putting it into the background is breaking
the file descriptor connections (the 'cat'
program runs, but stops immediately on EOF)
(2) The output pipe has to be closed before running
the 'cat'. In my test case I think this is
because the output of the 'ls' is insufficient
to cause a buffer write and so the close(L[2])
is required to ensure that the write buffer
gets sent down the pipe.
Offhand, I'd say that's a bug in Unicon...
--
Steve Wampler <[EMAIL PROTECTED]>
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group