Both the Java and Python stdlib alternatives do return status and output.
See Procedure for installing python libraries from source - #18 by Kevin.Herron for an example.
also https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Process.html#exitValue()