[comp.lang.perl] Open Pipe to Interactive-only Process?

mer6g@virginia.edu (Marc Rouleau) (10/31/90)

Has anyone written a routine to open a pipe to a process which
requires that its input come from a tty?  I think the fakeout
involves pseudo-terminals, but I don't know much about them and
would just as soon use someone else's code if it exists.

To be slightly more specific, I'm trying to run tip from perl
on a Sun4.  Being able to do something like

    ptyopen(TIP,"|/usr/bin/tip portb");

would be wonderful, but even if you have it in less elegant form
I would love to see your code.

    -- Marc Rouleau

merlyn@iwarp.intel.com (Randal Schwartz) (10/31/90)

In article <1990Oct30.212537.1904@uvaarpa.Virginia.EDU>, mer6g@virginia (Marc Rouleau) writes:
| Has anyone written a routine to open a pipe to a process which
| requires that its input come from a tty?  I think the fakeout
| involves pseudo-terminals, but I don't know much about them and
| would just as soon use someone else's code if it exists.
| 
| To be slightly more specific, I'm trying to run tip from perl
| on a Sun4.  Being able to do something like
| 
|     ptyopen(TIP,"|/usr/bin/tip portb");
| 
| would be wonderful, but even if you have it in less elegant form
| I would love to see your code.

The first quick answer is use PTY's.  People have posted code here
from time to time to use them.

The slow answer is, if you hold on about a week or two, you may be
pleased by some code that Larry and I have been working on.  Hint: if
you've seen Don Libes "expect", you will be seeing double.

&spawn(SH,"/bin/sh");&send(SH,"echo Just another Perl hacker,\n");
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel put the 'backward' in 'backward compatible'..."=========/