@@ -174,7 +174,11 @@ def is_executable(exe):
174174 check = True ,
175175 )
176176 except (subprocess .CalledProcessError , OSError ) as err :
177- raise MadoopError (f"Failed executable test: { err } " ) from err
177+ stderr_output = ""
178+ if isinstance (err , subprocess .CalledProcessError ) and err .stderr :
179+ stderr_output = '\n ' + err .stderr .decode ()
180+ raise MadoopError (f"Failed executable test: { err } "
181+ f"{ stderr_output } " ) from err
178182
179183
180184def part_filename (num ):
@@ -198,11 +202,16 @@ def map_single_chunk(exe, input_path, output_path, chunk):
198202 check = True ,
199203 input = chunk ,
200204 stdout = outfile ,
205+ stderr = subprocess .PIPE
201206 )
202207 except (subprocess .CalledProcessError , OSError ) as err :
208+ stderr_output = ""
209+ if isinstance (err , subprocess .CalledProcessError ) and err .stderr :
210+ stderr_output = '\n ' + err .stderr .decode ()
203211 raise MadoopError (
204212 f"Command returned non-zero: "
205213 f"{ exe } < { input_path } > { output_path } "
214+ f"{ stderr_output } "
206215 ) from err
207216
208217
@@ -300,6 +309,7 @@ def partition_keys_custom(
300309 [partitioner , str (num_reducers )],
301310 stdin = stack .enter_context (inpath .open ()),
302311 stdout = subprocess .PIPE ,
312+ stderr = subprocess .PIPE ,
303313 text = True ,
304314 ))
305315 for line , partition in zip (
@@ -326,8 +336,12 @@ def partition_keys_custom(
326336
327337 return_code = process .wait ()
328338 if return_code :
339+ stderr_output = process .stderr .read ()
340+ if len (stderr_output ) != 0 :
341+ stderr_output = '\n ' + stderr_output
329342 raise MadoopError (
330343 f"Partition executable returned non-zero: { str (partitioner )} "
344+ f"{ stderr_output } "
331345 )
332346
333347
@@ -419,11 +433,16 @@ def reduce_single_file(exe, input_path, output_path):
419433 check = True ,
420434 stdin = infile ,
421435 stdout = outfile ,
436+ stderr = subprocess .PIPE
422437 )
423438 except (subprocess .CalledProcessError , OSError ) as err :
439+ stderr_output = ""
440+ if isinstance (err , subprocess .CalledProcessError ) and err .stderr :
441+ stderr_output = '\n ' + err .stderr .decode ()
424442 raise MadoopError (
425443 f"Command returned non-zero: "
426444 f"{ exe } < { input_path } > { output_path } "
445+ f"{ stderr_output } "
427446 ) from err
428447
429448
0 commit comments