Re: script input redirection / eof handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 03, 2013 at 12:25:13AM +0100, Karel Zak wrote:
> On Mon, Dec 02, 2013 at 01:06:05PM -0500, Phillip Susi wrote:
> > That only works if the program on the other end knows what "exit"
> > means, which is basically only true if it's a shell.  Surely there
> > must be a proper way to signal EOF over a pty?  Can you use shutdown()
> > on a pty?
> 
>  Oh, now it reminds me... in include/ttyutils.h we have macros to
>  generate tty control chars, for example ^C
> 
> 			char eof = DEF_EOF;
> 
> 			if (write(master, &eof, 1) < 0) {
> 				warn (_("write failed"));
> 				fail();
> 			}
>             pause();
>            
>  is what we need. 

 It was more tricky than I have originally expected, but it seems it
 works. (It seems that it is not enough to send EOF, you have to be
 sure that someone already listens on slave side.)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux