[FFmpeg-trac] #42(FFmpeg:new): don't read stdin when running in a noninteractive shell

FFmpeg trac at avcodec.org
Tue Jun 7 21:19:55 CEST 2011


#42: don't read stdin when running in a noninteractive shell
---------------------------------------+----------------------
Reporter:  taeuber                     |       Owner:  michael
    Type:  enhancement                 |      Status:  new
Priority:  wish                        |   Component:  FFmpeg
 Version:  git                         |  Resolution:
Keywords:  noninteractive shell stdin  |  Blocked By:
Blocking:                              |  Reproduced:  0
Analyzed:  0                           |
---------------------------------------+----------------------

Comment (by taeuber):

 Hi michael,

 I'm not sure but this seems to be it:

 $ man 4 tty
 $ man tcgetpgrp
 $ man getpgid

 int am_I_interactive()
 {
   int fd = open ("/dev/tty", O_RDONLY);
   int interactive = (tcgetpgrp(fd) == getpgid());
   close (fd);
   return interactive;
 }

 This is stolen from:
 http://www.perlmonks.org/?node_id=472070

 I understand this as following:

 If I'm the process group leader I am interactive otherwise I'm
 noninteractive. (only on posix systems)

 Thanks
 Lars

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/42#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list