Bug#192228: [apt-0.5.4] [patch] isatty for stdin clear
Package: apt
Version: 0.5.4
Severity: wishlist
Hi,
is a patch like this acceptable ? I am working on automatic upgrades for
hundrets of machines and a
yes | apt-get -fuy install xyz
Goes on like mad trying to clear the stdin. Solution i used was
to renice yes which makes the stdin be empty at some point. I know
there is an option (After looking into the source) but this would
be the obvious way - Trying to protect the user concerning accident
input is obviously unecessary on non tty's.
diff -Nur apt-0.5.4/apt-pkg/deb/dpkgpm.cc apt-0.5.4.flo/apt-pkg/deb/dpkgpm.cc
--- apt-0.5.4/apt-pkg/deb/dpkgpm.cc 2001-05-27 04:42:19.000000000 +0000
+++ apt-0.5.4.flo/apt-pkg/deb/dpkgpm.cc 2003-05-07 00:51:35.000000000 +0000
@@ -452,7 +452,8 @@
if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0)
_exit(100);
- if (_config->FindB("DPkg::FlushSTDIN",true) == true)
+ if (_config->FindB("DPkg::FlushSTDIN",true) == true &&
+ isatty(STDIN_FILENO))
{
int Flags,dummy;
if ((Flags = fcntl(STDIN_FILENO,F_GETFL,dummy)) < 0)
Flo
--
Florian Lohoff flo@rfc822.org +49-5201-669912
Heisenberg may have been here.
Reply to: