[PATCH] Discard stderr when calling system-image-cli. Avoids spurious error messages when system-image-cli is installed on a non-"Ubuntu-RTM" machine. (LP: #267935)
Signed-off-by: John R. Lenton <john.lenton@canonical.com>
---
aptsources/distro.py | 7 ++++++-
debian/changelog | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/aptsources/distro.py b/aptsources/distro.py
index ac1c55e..883420f 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -487,8 +487,13 @@ def _system_image_channel():
from subprocess import Popen, PIPE
import errno
try:
+ from subprocess import DEVNULL
+ except ImportError:
+ # no DEVNULL in 2.7
+ DEVNULL = os.open(os.devnull, os.O_RDWR)
+ try:
out = Popen(
- ['system-image-cli', '-i'], stdout=PIPE,
+ ['system-image-cli', '-i'], stdout=PIPE, stderr=DEVNULL,
universal_newlines=True).communicate()[0]
for l in out.splitlines():
if l.startswith('channel: '):
diff --git a/debian/changelog b/debian/changelog
index 34cab0a..0e3c07d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+python-apt (1.0.0~beta3.1+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Discard stderr when calling system-image-cli. Avoids spurious error
+ messages when system-image-cli is installed on a non-"Ubuntu-RTM"
+ machine. (LP: #1484470)
+
+ -- John R. Lenton (Chipaca) <john.lenton@canonical.com> Thu, 13 Aug
2015 12:29:53 +0100
+
python-apt (1.0.0~beta3.1) unstable; urgency=medium
[ Michael Vogt ]
--
2.5.0
Reply to: