[Apt-listbugs-commits] [SCM] apt-listbugs development tree branch, master, updated. debian/0.1.3-12-g5931f36
Ryan Niebur
ryanryan52 at gmail.com
Sun May 2 17:04:26 UTC 2010
The following commit has been merged in the master branch:
commit 5931f3608763d361a13f0a76258c6d919fe01308
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date: Sun May 2 10:03:23 2010 -0700
flush stdin after running the web browser (Closes: #578299)
diff --git a/debian/changelog b/debian/changelog
index 08b33c9..ad7cfea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,8 +13,9 @@ apt-listbugs (0.1.4) UNRELEASED; urgency=low
[ Ryan Niebur ]
* updated German translation, thanks Thomas Mueller! (Closes: #578305)
+ * flush stdin after running the web browser (Closes: #578299)
- -- Ryan Niebur <ryan at debian.org> Sun, 02 May 2010 09:44:35 -0700
+ -- Ryan Niebur <ryan at debian.org> Sun, 02 May 2010 09:49:38 -0700
apt-listbugs (0.1.3) unstable; urgency=low
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 49b77d1..b2d4ee2 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -621,6 +621,27 @@ Pin-Priority: #{pin_pri}
$stderr.puts _("W: Failed to invoke www-browser.")
$stderr.puts " #{browsercommandline}"
end
+ clear_stdin
+ end
+
+ private
+ def clear_stdin(parent = true)
+ fd = @config.frontend.tty
+ flags=fd.fcntl(Fcntl::F_GETFL)
+ if parent
+ while clear_stdin(false)
+ nil
+ end
+ else
+ begin
+ fd.read_nonblock(10000000)
+ return true
+ rescue Errno::EAGAIN
+ return false
+ ensure
+ fd.fcntl(Fcntl::F_SETFL, flags)
+ end
+ end
end
end
@@ -1132,12 +1153,16 @@ class ConsoleFrontend
$stdout.puts msg
end
+
+ def tty
+ @tty ||= open("/dev/tty")
+ end
+
def ask(msg)
$stdout.print "#{msg} "
$stdout.flush
line = nil
- @tty = open("/dev/tty") if @tty == nil
- line = @tty.gets
+ line = self.tty.gets
if line != nil
line.chomp!
end
--
apt-listbugs development tree
More information about the Apt-listbugs-commits
mailing list