3

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
mmmmmm
  • 32,227
  • 27
  • 88
  • 117
StuFF mc
  • 4,137
  • 2
  • 33
  • 32
  • FYI, it doesn't solve the *real* problem, but I decided to fix the code of the "bad definition" file, by doing this: `sdef ... | sed 's/ – StuFF mc Jul 18 '11 at 22:35

1 Answers1

2

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.

Jeff Laing
  • 913
  • 7
  • 13
  • Nope. That won't help, because in this case, no output files (here `$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).h`) would be generated, and thus the compiler will break later in my project. But that's a good tip anyways. – StuFF mc Jul 19 '11 at 08:05