[Issue 15915] std.process.execute throws an exception when using workDir and a relative path

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 12 06:11:47 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15915

--- Comment #4 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Atila Neves from comment #3)
> However, I don't think the current implementation makes sense. There's
> already an if to check if the path has directory separators in it - if
> workDir is not "", I think what makes sense is to be relative to workDir.

I'm not sure what you mean. I don't see any code that examines the format of
workDir.

> execute(["./foo"]); //look for ./foo
> execute(["./foo"], ..., "bar"); //look for bar/foo
> execute(["foo"]); //search path for foo
> execute(["foo", ..., "bar"); //search path for foo

Look for foo in relation to the *current process* working directory, not the
working directory for the *new process*.

If you think about it a while, it would not make any sense to search for the
executable based on the target's working directory. This would mean you could
easily hijack the execute call by putting a correctly named file in the target
directory.

--


More information about the Digitalmars-d-bugs mailing list