code: public static void assertExitValue(Process proc, int expectedExitValue) throws CommandFailedException {
  		int actualExitValue = proc.exitValue();
  		if (actualExitValue != expectedExitValue) {
  			try {
  				String error = toString(proc.getErrorStream(), StandardCharsets.UTF_8);
  				throw new CommandFailedException("Command failed with exit code " + actualExitValue + ". Expected " + expectedExitValue + ". Stderr: " + error);
  			} catch (IOException e) {
  				throw new CommandFailedException("Command failed with exit code " + actualExitValue + ". Expected " + expectedExitValue + ".");
  			}
  		}
  	}
docs: Fails with a CommandFailedException, if the process did not finish with the expected exit code.
  
  @param proc A finished process
  @param expectedExitValue Exit code returned by the process
  @throws CommandFailedException Thrown in case of unexpected exit values