Expected Behavior
I would like to run ganache-cli in such a way that it runs in the background but the command returns when the startup is done. Right now to do that you have to do something like:
ganache-cli &
sleep 5
# interact with localhost:8545 somehow
because ganache isn't immediately ready. With a proper flag, this would become:
ganache-cli --detach
# interact with localhost:8545 somehow
Current Behavior
As explained in the previous section, right now you have to start the process in the background (using &) and then you have to wait a while (how much changes a lot from machine to machine) until it's ready.
Possible Solution
A flag like --detach should do the trick. In docker, this flag has the -d shortcut, but that's already reserved in ganache. Besides, it's likely that most people won't need this, so having just a long flag should be OK.
I'm not really sure about detach though, since it might imply "it will continue to work if the terminal is closed", which might not be the case.
Context
Having something like this would be specially useful for scripts and CIs. I've seen a lot of scripts and CI configurations that start ganache in the background and then sleep for 3-5 seconds.
Something to take into account is that the user will probably want to have the PID of the process. This could be the only thing that is printed, so you can use it like this:
PID=`ganache-cli --detach`
# do some stuff
kill $PID
Expected Behavior
I would like to run
ganache-cliin such a way that it runs in the background but the command returns when the startup is done. Right now to do that you have to do something like:because ganache isn't immediately ready. With a proper flag, this would become:
ganache-cli --detach # interact with localhost:8545 somehowCurrent Behavior
As explained in the previous section, right now you have to start the process in the background (using
&) and then you have to wait a while (how much changes a lot from machine to machine) until it's ready.Possible Solution
A flag like
--detachshould do the trick. In docker, this flag has the-dshortcut, but that's already reserved in ganache. Besides, it's likely that most people won't need this, so having just a long flag should be OK.I'm not really sure about
detachthough, since it might imply "it will continue to work if the terminal is closed", which might not be the case.Context
Having something like this would be specially useful for scripts and CIs. I've seen a lot of scripts and CI configurations that start ganache in the background and then sleep for 3-5 seconds.
Something to take into account is that the user will probably want to have the PID of the process. This could be the only thing that is printed, so you can use it like this: