Re: using subproc.py (elaborated)

Ken Manheimer (klm@NIST.GOV)
Mon, 10 Apr 1995 10:59:03 -0400 (EDT)

On Mon, 10 Apr 1995 hajime@jsk.t.u-tokyo.ac.jp wrote:

> The problem is that I am having trouble using subproc.py
> under linux.
>
> The example code is as follows...
>
> ------------------------------
>
> >>> import subproc
> >>> pgnuplt = subproc.Subprocess('gnuplot')
> >>> pgnuplt.write('quit')
>
> --------------
> using 'ps' showed that gnuplot was still alive.
> --------------

Perhaps you need to use 'writeline' instead of 'write':

>>> pgnuplt.writeline('quit')

? (This is simply equivalent to "pgnuplt.write('quit\n')".)

As it is, you're sending an incomplete line to the process, and if it's
line-oriented, then it's likely to hang around waiting for that newline
termination.

> >>> pgnuplt.die()
> >>> pgnuplt.status()
> 'sans process'
> >>>
> ---------------
> But 'ps' shows that gnuplot is still alive.

As it is, you're sending an incomplete line to the process, and if it's
line-oriented, then it's likely to hang around waiting for that
termination.

Hope this helps.

ken
ken.manheimer@nist.gov, 301 975-3539