Prefer to() over cast
(Re-)fix failing environment test on Windows

This had already been fixed in the "old" std.process, it just needed to
be transferred to the new one.