Title: [264064] trunk/Tools
Revision
264064
Author
[email protected]
Date
2020-07-08 01:39:59 -0700 (Wed, 08 Jul 2020)

Log Message

[Flatpak] Avoid error message 'error: org.webkit.Sdk/*unspecified*/*unspecified*' not installed
https://bugs.webkit.org/show_bug.cgi?id=213871

Reviewed by Philippe Normand.

The error message happens when requesting a Flatpak SDK version but there's no Flatpak SDK installed yet.
In that case, ignore stderr to filter out the message.

* flatpak/flatpakutils.py:
(run_sanitized):
(FlatpakObject.flatpak):
(FlatpakObject.version):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (264063 => 264064)


--- trunk/Tools/ChangeLog	2020-07-08 08:20:05 UTC (rev 264063)
+++ trunk/Tools/ChangeLog	2020-07-08 08:39:59 UTC (rev 264064)
@@ -1,3 +1,18 @@
+2020-07-08  Diego Pino Garcia  <[email protected]>
+
+        [Flatpak] Avoid error message 'error: org.webkit.Sdk/*unspecified*/*unspecified*' not installed
+        https://bugs.webkit.org/show_bug.cgi?id=213871
+
+        Reviewed by Philippe Normand.
+
+        The error message happens when requesting a Flatpak SDK version but there's no Flatpak SDK installed yet.
+        In that case, ignore stderr to filter out the message.
+
+        * flatpak/flatpakutils.py:
+        (run_sanitized):
+        (FlatpakObject.flatpak):
+        (FlatpakObject.version):
+
 2020-07-08  Philippe Normand  <[email protected]>
 
         [Flatpak SDK] Initial installation with IceCC enabled fails

Modified: trunk/Tools/flatpak/flatpakutils.py (264063 => 264064)


--- trunk/Tools/flatpak/flatpakutils.py	2020-07-08 08:20:05 UTC (rev 264063)
+++ trunk/Tools/flatpak/flatpakutils.py	2020-07-08 08:39:59 UTC (rev 264064)
@@ -119,7 +119,7 @@
         cls.colored_message_if_supported(Colors.WARNING, str_format, *args)
 
 
-def run_sanitized(command, gather_output=False):
+def run_sanitized(command, gather_output=False, ignore_stderr=False):
     """ Runs a command in a santized environment and optionally returns decoded output or raises
         subprocess.CalledProcessError
     """
@@ -132,7 +132,11 @@
 
     keywords = dict(env=sanitized_env)
     if gather_output:
-        output = subprocess.check_output(command, **keywords)
+        if ignore_stderr:
+            with open(os.devnull, 'w') as devnull:
+                output = subprocess.check_output(command, stderr=devnull, **keywords)
+        else:
+            output = subprocess.check_output(command, **keywords)
         return output.decode('utf-8')
     else:
         keywords["stdout"] = sys.stdout
@@ -179,6 +183,7 @@
     def flatpak(self, command, *args, **kwargs):
         comment = kwargs.pop("comment", None)
         gather_output = kwargs.get("gather_output", False)
+        ignore_stderr = kwargs.get("ignore_stderr", False)
         if comment:
             Console.message(comment)
 
@@ -194,11 +199,11 @@
         command.extend(args)
 
         _log.debug("Executing %s" % ' '.join(command))
-        return run_sanitized(command, gather_output=gather_output)
+        return run_sanitized(command, gather_output=gather_output, ignore_stderr=ignore_stderr)
 
     def version(self, ref_id):
         try:
-            output = self.flatpak("info", ref_id, gather_output=True)
+            output = self.flatpak("info", ref_id, gather_output=True, ignore_stderr=True)
         except subprocess.CalledProcessError:
             # ref is likely not installed
             return ""
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to