bug #23319: rework the way we handle the working directory when invoking