Am 24.10.2013 19:03, schrieb Timothee Cour:
+1
this is a command use case. Further,relying on shell such as  cd subdir
&& foo is fragile: if it fails, we're not sure whether it's because it
couldn't cd to subdir or because of foo.

Woudl the following be as efficient?
system_in_dir(string dir, string action){
auto path=getcwd
scope(exit)
   chdir(path)
chdir(dir)
system(action)
}


Well at least the windows API call CreateProcess already has a parameter which you can use to specify the working directory. Its just not exposed in the implementation of std.process. I don't know how things are on linux though.

Kind Regards
Benjamin Thaut

Reply via email to