@@ -64,7 +64,7 @@ def run_with_output(cmd, env=None, env_out=None):
6464 cmd = " " .join (cmd ) if isinstance (cmd , list ) else cmd
6565
6666 env = handle_env (env )
67- proc = subprocess .run (cmd , capture_output = True , text = True , shell = True , env = env )
67+ proc = subprocess .run (cmd , capture_output = True , text = True , shell = True , env = env , errors = "replace" )
6868 parse_environment (proc .stdout , env_out )
6969 return proc
7070
@@ -124,6 +124,7 @@ def run_stream(cmd, env=None, logfunc=None, cwd=None):
124124 cwd = cwd ,
125125 startupinfo = startupinfo ,
126126 encoding = "utf8" ,
127+ errors = "replace" ,
127128 )
128129 returncode = None
129130 while True :
@@ -145,7 +146,7 @@ def run_with_stdin(cmd, input, env=None, env_out=None):
145146
146147 env = handle_env (env )
147148 proc = subprocess .run (
148- cmd , input = input , capture_output = True , text = True , shell = True , env = env
149+ cmd , input = input , capture_output = True , text = True , shell = True , env = env , errors = "replace"
149150 )
150151 parse_environment (proc .stdout , env_out )
151152 return proc
@@ -164,6 +165,7 @@ def run_with_combined_output(cmd, env=None, env_out=None):
164165 stdout = subprocess .PIPE ,
165166 stderr = subprocess .STDOUT ,
166167 env = env ,
168+ errors = "replace" ,
167169 )
168170 parse_environment (proc .stdout , env_out )
169171 return proc
@@ -253,6 +255,7 @@ def whereis(app):
253255 check = True ,
254256 stdout = subprocess .PIPE ,
255257 stderr = subprocess .STDOUT ,
258+ errors = "replace" ,
256259 ).stdout
257260 except CalledProcessError :
258261 pass
0 commit comments