Check if parity is running
Instead of using ps-node
and doing a ps aucx | grep parity
to find out if an instance of parity is already running, we now do something simpler. We just ping:
127.0.0.1:8545
127.0.0.1:8546
- and whatever --ws-port and --ws-interface the user inputs.
If one of them is responding, then we assume there's a parity instance running. This should cover most of the use cases.
The reason why we drop ps-node
is that there might be another command containing parity in the name (e.g. parity-ui, parity*?) which would create false positives hard to debug.
Also, if there indeed is another parity running (on a custom port), then electron will still launch its own parity, but there would be a recognizable error (lock file in use
, or ...is already in use
); we catch those errors, and silently ignore them.
cc @Tbaut