Java ProcessBuilder.exec and hanging processes and silent failures

When using ProcessBuilder to start consul and then other applications, processes were silently failing and hanging.

DO NOT USE bash -i with consul. The -i is needed for some other process execs to initialize the environment.
The following command appears to complete properly.
After the processBuilder.start(), future process silently hang and fail for some unknown reason.
Execution always worked properly from eclipse, but never from command line.

Works from eclipse, but from command line caused future ProcessBuilder silent failures.
String[] commandArray = {"/bin/bash", "-i", "-c", new "/opt/consul/consul agent -server -bootstrap -data-dir /tmp/consul -ui-dir /opt/consul/consul-ui/dist/"};

Works from eclipse and command line, no future ProcessBuilder failures.
String[] commandArray = {"/bin/bash", "-c", "/opt/consul/consul agent -server -bootstrap -data-dir /tmp/consul -ui-dir /opt/consul/consul-ui/dist/"};

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout