Re: [squeak-dev] Re: Unix OSProcess error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Unix OSProcess error

Gary Dunn
> On Thu, Aug 06, 2009 at 01:08:35PM -0700, Andreas Raab wrote:
> > David T. Lewis wrote:
> > >If you can send me an example of something that you are doing, I'll try to
> > >suggest something more specific to address the problem. I'm away from
> > >Squeak
> > >at the moment, so it may take me a while to respond.
> >
> > We're doing stuff along the lines of:
> >
> > "fire off the external command"
> > cmd := PipeableOSProcess command: '/home/qwaq/server/script.sh'
> > environment: nil
> > workingDir: nil
> > input: nil
> > output: nil
> > error: nil
> > errorPipelineStream: nil.
> >
> > "wait for completion"
> > start := Time millisecondClockValue.
> > [cmd isComplete not and:[(Time millisecondsSince: start) < deadline]]
> > whileTrue:[(Delay forMilliseconds: 100) wait].
> > cmd isComplete ifFalse:[^self error: 'timeout'].
> >
> > descriptors := cmd outputAndError.
> > "... processing of output and error omitted ..."
> >
> > And that's it. Is there anything that we need to clean up here?
>
> Probably yes. From memory I think that 'cmd closePipes' will do what you
> need. But I'm sure there are cleaner ways to do this, so I'll give you
> a better answer later on when I get home a few hours from now. I guess
> it's time I started carrying one of Bert's Squeak-on-a-stick solutions
> on my keychain ;)
>
> Dave
>

You might need a pipe close in the ifFalse branch of the cmd isComplete
statement.


Gary Dunn
Open Slate Project