From 40178a161e2b3bfb67ee337aee7dd80759d5332a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 18 Sep 2014 07:46:00 +0200 Subject: [PATCH] appmenus: mute output when verbose=False --- appmenus-scripts/qubes-core-appmenus.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/appmenus-scripts/qubes-core-appmenus.py b/appmenus-scripts/qubes-core-appmenus.py index 3157290..75ed1b0 100644 --- a/appmenus-scripts/qubes-core-appmenus.py +++ b/appmenus-scripts/qubes-core-appmenus.py @@ -77,13 +77,23 @@ def QubesVm_appmenus_create(self, verbose=False, source_template = None): vmtype = 'appvms' try: + msgoutput = None if verbose else open(os.devnull, 'w') if source_template is not None: - subprocess.check_call ([system_path["appmenu_create_cmd"], source_template.appmenus_templates_dir, self.name, vmtype, self.label.icon]) + subprocess.check_call([system_path["appmenu_create_cmd"], + source_template.appmenus_templates_dir, + self.name, vmtype, self.label.icon], + stdout=msgoutput, stderr=msgoutput) elif self.appmenus_templates_dir is not None: - subprocess.check_call ([system_path["appmenu_create_cmd"], self.appmenus_templates_dir, self.name, vmtype, self.label.icon]) + subprocess.check_call ([system_path["appmenu_create_cmd"], + self.appmenus_templates_dir, self.name, + vmtype, self.label.icon], + stdout=msgoutput, stderr=msgoutput) else: # Only add apps to menu - subprocess.check_call ([system_path["appmenu_create_cmd"], "none", self.name, vmtype, self.label.icon]) + subprocess.check_call ([system_path["appmenu_create_cmd"], + "none", self.name, vmtype, + self.label.icon], + stdout=msgoutput, stderr=msgoutput) except subprocess.CalledProcessError: print >> sys.stderr, "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name) @@ -95,7 +105,8 @@ def QubesVm_appmenus_remove(self): vmtype = 'vm-templates' else: vmtype = 'appvms' - subprocess.check_call ([system_path["appmenu_remove_cmd"], self.name, vmtype]) + subprocess.check_call ([system_path["appmenu_remove_cmd"], self.name, + vmtype], stderr=open(os.devnull, 'w')) def QubesVm_appicons_create(self, srcdir=None): if srcdir is None: