Fix restarting of the agents hangs the slave when running hg command