It was only checking the return code, but astyle was always returning 0. Changed to parse the output and look for the string "Formatted"