subprocess.h icon indicating copy to clipboard operation
subprocess.h copied to clipboard

Invoking subprocess in different directory instead of parent directory

Open pvkarthikk opened this issue 1 year ago • 1 comments

what is the right way to support to current directory while creating subprocess?

if (!CreateProcessA(
          SUBPROCESS_NULL,
          commandLineCombined, // command line
          SUBPROCESS_NULL,     // process security attributes
          SUBPROCESS_NULL,     // primary thread security attributes
          1,                   // handles are inherited
          flags,               // creation flags
          used_environment,    // used environment
          SUBPROCESS_NULL,     // use parent's current directory
          SUBPROCESS_PTR_CAST(LPSTARTUPINFOA,
                              &startInfo), // STARTUPINFO pointer
          SUBPROCESS_PTR_CAST(LPPROCESS_INFORMATION, &processInfo))) {
    return -1;
  }

pvkarthikk avatar Aug 08 '24 06:08 pvkarthikk

There's no option for that in the library. Could maybe be added - but I've not got the energy to look into it. For now change the current directory of the parent process before using the library.

sheredom avatar Aug 24 '24 19:08 sheredom