comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Can one close only one of STDIN and STDOUT when using SPAWN with the UNIT keyword?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Can one close only one of STDIN and STDOUT when using SPAWN with the UNIT keyword? [message #83804 is a reply to message #83700] Sun, 31 March 2013 02:35 Go to previous message
tom.grydeland is currently offline  tom.grydeland
Messages: 51
Registered: September 2012
Member
> On Tuesday, March 26, 2013 6:30:04 PM UTC-4, Tom Grydeland wrote:
>> In IDL, when using SPAWN with the UNIT keyword, one file unit is supposed to be used for both directions. Is it possible to do the above from IDL?

On Wednesday, March 27, 2013 8:02:08 PM UTC+1, Craig Markwardt wrote:
> This is the standard race condition that exists for bidirectional pipes. I don't think you can work around it with IDL.

The race condition I believe you refer to occurs when both processes wait for input from the other side. In the case of a reducing utility (such as 'wc' or 'md5sum'), there is no race if one is able to signal the end of input to the other side (i.e. CLOSE its input, as I asked about originally).

This simply begs the question: Why use one bidirectional pipe instead of separate pipes for stdin and stdout (and stderr, if so desired)? This approach creates problems, and appears not to solve any.

> You might be better off redirecting the output of your program to a file, and then reading the file when the SPAWN'd process is complete.

I understand workarounds. I program in IDL, so I eat, drink, dream and breathe workarounds. It is just that IDL would be so much nicer to program in if one didn't have to expend so much of the creative energy on workarounds.

There are legitimate resons why one might not want to use temporary files for all kinds of tasks, and the UNIT keyword to the SPAWN command seems to have been provided to cater for this demand. Only it doesn't.

> Craig

Possible language changes that would solve the issue:

1) Two or three new keywords to SPAWN that are used to return separate UNITs for the three standard streams
2) A way to close one direction only of a bidirectional pipe.
3) New routine(s), along the lines of those in the popen2 module (Python) or Open3 module (Ruby).

Cheers,

--T
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Calculating difference between each element in array from previous
Next Topic: A Healthy Alternative to Takeaway Regret

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 11:06:49 PST 2025

Total time taken to generate the page: 0.16288 seconds