Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have Xcode not care about errors coming back from a custom script (/dev/null)?

I have a custom script in Xcode which returns an error, but suppose I don't care. Xcode doesn't care about /dev/null and won't compile

sdef "$INPUT_FILE_PATH" | sdp -fh -o "$DERIVED_FILES_DIR" 
--basename "$INPUT_FILE_BASE" 
--bundleid `defaults read "$INPUT_FILE_PATH/Contents/Info" CFBundleIdentifier`

It's basically for generating a .h file based on Apple Script Definitions, and it went all fine up until a recent OS X update.

In the terminal, all I have to so is end this command with

2>/dev/null 

and no error is returned. Whatever I try with 2> or just > or even &> doesn't work in Xcode, it will always return me an error.

/bin/sh -c "sdef \"$INPUT_FILE_PATH\" | sdp -fh -o \"$DERIVED_FILES_DIR\" 
--basename \"$INPUT_FILE_BASE\" --bundleid `defaults read
\"$INPUT_FILE_PATH/Contents/Info\" CFBundleIdentifier` 2> /dev/null"

Command /bin/sh failed with exit code 1
like image 705
StuFF mc Avatar asked Dec 31 '25 20:12

StuFF mc


1 Answers

Appending 2>/dev/null does not prevent the error status being returned by the sdef command, it just hides the error message.

Replace it with

|| echo "Failed".

If the sdef fails, the second part of the command is exited, and the echo should not report a bad status.

like image 129
Jeff Laing Avatar answered Jan 04 '26 00:01

Jeff Laing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!