[gtk-mac-bundler] Fix unicode decode error



commit 676a87c36316afc14b54e9761a89ed78f7ff8aca
Author: Lukas Oberhuber <lukaso gmail com>
Date:   Thu Sep 22 15:35:20 2022 +0100

    Fix unicode decode error
    
    Getting strings from the binaries can return badly encoded strings which
    don't match what Python is expecting. This fix discards any bad strings
    which are returned and continues.

 bundler/bundler.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/bundler/bundler.py b/bundler/bundler.py
index 3fe12a7..a977c04 100644
--- a/bundler/bundler.py
+++ b/bundler/bundler.py
@@ -6,6 +6,7 @@ import sys
 import os, errno, glob
 import shutil
 import re
+import subprocess
 from subprocess import Popen
 import plistlib
 from .project import *
@@ -420,8 +421,8 @@ class Bundler(object):
 
         # Get strings from binaries.
         for f in self.list_copied_binaries():
-            p = os.popen("strings " + f)
-            for string in p:
+            p = subprocess.run("strings " + f, shell=True, stdout=subprocess.PIPE, text=True, 
errors='ignore')
+            for string in p.stdout.splitlines():
                 string = string.strip()
                 strings.add(string)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]