www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with escaping commands in spawProcess().

reply "Cooler" <kulkin hotbox.ru> writes:
import std.process;

int main(string[]){
   // Next line will generate error message from cmd.exe
   spawnProcess(["cmd.exe", "/C", "echo"]).wait();
   return 0;
}

Running the code above will result in windows shell error 
message. As I understand the error is due to escaping all 
arguments in std.process.spawnProcess function.

int main(string[]){
   spawnShell("cmd.exe /C echo").wait(); // Works fine
   return 0;
}

Is there any way to run the code with spawnProcess instead of 
spawnShell?
Mar 07 2014
parent "Andrej Mitrovic" <andrej.mitrovich gmail.com> writes:
On Friday, 7 March 2014 at 09:26:27 UTC, Cooler wrote:
 import std.process;

 int main(string[]){
   // Next line will generate error message from cmd.exe
   spawnProcess(["cmd.exe", "/C", "echo"]).wait();
   return 0;
 }
I'm not sure, but maybe file a bug so this gets some attention: https://issues.dlang.org/enter_bug.cgi?product=D
Apr 13 2014