Correctly set the working directory when launching processes for both local and remote targets.