Hello,

I am trying to do a small launcher for a Windows application which (in order to be portable) requires a specific parameter, and I am getting this error when I try to run it in Windows 7 SP1:

"std.process.ProcessException@std\process.d(518): Failed to spawn new process (Access denied.)"

This is the code I am trying to use:

import std.stdio, std.file, std.path, std.string, std.process;

static auto appname = "myapp";

int main(string[] args) {
  auto appath = dirName(thisExePath());
  auto appexe = buildPath(appath, appname ~ ".exe");
  auto appini = buildPath(appath, appname ~ ".ini");
  auto applaunchpars = format(`"%s" /ini="%s"`, appexe, appini);
  if (exists(appexe)) {
auto appPid = spawnProcess(applaunchpars, ["" : ""], Config.suppressConsole);
    scope(failure) return -1;
  }
  return 0;
}

The ugly ["" : ""] hack is because I haven't been able to invoke spawnProcess otherwise, at least withouth specifying stdin and stdout (which I don't really need right now). Actually, I was thinking in making my own wrapper for ShellExecuteA (I don't find spawnProcess particularly intuitive), but I would prefer "the D way".

Anyway, Where could the problem be?

Regards, Hugo

Reply via email to