0

How do i get the return value from a ninja parallel build? I want to do subsequent commands ONLY if the parallel build succeeded. Checking $? after the ninja command does not help..

quickdraw
  • 247
  • 1
  • 2
  • 12

1 Answers1

1

You can check if ninja build succeeded by checking the ninja command exit status for example in a bash script. Like suggested here you can write a function that launches and tests the command for you:

function test {
  "$@"
  local status=$?
  if [ $status -ne 0 ]; then
    echo "error with $1" >&2
  fi
  return $status
}

test ninja target
Community
  • 1
  • 1
stze
  • 11
  • 1
  • i already have a bash script that launches the ninja build(with the number of cores given by the user) and then I return*$? from the bash script, that does not give the value of the return code, it always retuns 0 – quickdraw Mar 28 '16 at 15:34
  • 1
    if the parallel build succeeds you'll get return code 0, if it fails return code 1. you can check it with the provided bash script. when the build fails, the script will echo "error with ninja" (tested it). – stze Mar 29 '16 at 22:36