Allow to pass a callback to the method that runs remote commands.