0

During an Xcode build, I run a custom script calling "make". In order to parse the error messages to obey Xcode error formatting, I use:

make 2>&1

Then reformat every line using sed.

The problem is, this causes any make error exit codes to disappear, and Xcode reports:

Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

or even a "build succeeded" with link errors.

How can I get back the error exit codes?

gil_mo
  • 575
  • 1
  • 6
  • 27
  • 1
    See [Pipe output and capture exit status in Bash](https://stackoverflow.com/questions/1221833/pipe-output-and-capture-exit-status-in-bash). If the whole script is just `make 2>&1 | sed ...` then append the line `exit "${PIPESTATUS[0]}"`. This should work for `bash`. You tagged your question as `bash` but your quoted output says `/bin/sh`. Can you clear up this confusion? – Socowi Dec 04 '18 at 09:55
  • tomayto, tomahto. Works the same... :) – gil_mo Dec 04 '18 at 10:54

0 Answers0