The current directory may be read-only. Also the temporary files created by multiple processes running simultaneously may clash: https://github.com/dlang/dmd/commit/f3a0366f4f3e4af2f793fa6444b203b6a0adce0a As a solution, the relevant code responsible for creating temporary files can be probably borrowed from `rdmd`, `dub` or `rund`.
ldc2/ldmd2 also support '-run' option and don't attempt to write object files to the current directory.