On Tuesday, 9 July 2013 at 15:02:59 UTC, Jakob Ovrum wrote:
On Tuesday, 9 July 2013 at 14:21:48 UTC, David wrote:
Having pushd/popd in std.process would make a lot of code look better, often you have to change the workding directory only for a few commands, with pushd/popd you don't have to temporarily store the old one explicitly.

pushd/popd: https://en.wikipedia.org/wiki/Pushd_and_popd

What do you think?


void build() {
   pushd("../build")
   scope(exit) popd();

   shell("cmake ../src/c/bla");
   shell("make");
}

I think it's a good idea, except instead of maintaing a separate stack it could use the call stack through RAII. Also, considering `getcwd` and `chdir` are in std.file, maybe that's the better location?

-snip-

Apropos threads; this isn't thread-safe at all, is it... does it make sense to define semantics with multi-threading in mind?


Reply via email to