bau icon indicating copy to clipboard operation
bau copied to clipboard

BauExec: How to run programs from the path?

Open aarondandy opened this issue 10 years ago • 3 comments

The Exec task has ShellExecute = false for reasons which are understood but because of this I am unable to execute programs that are located on the system path. Is there or should there be a way to specify that the command should be located on the system/user PATH? Currently if I need to run a program located on the PATH I am doing this:

.Task("npm")
.Do(() => {
    new System.Diagnostics.ProcessStartInfo("npm"){
        Arguments = "install",
        WorkingDirectory = repositoryDir.FullName
    }.Run();
})

Major edit: I meant false, not true!

aarondandy avatar Dec 24 '14 21:12 aarondandy

May need to create something to parse Environment.GetEnvironmentVariable ("PATH") for multiple platforms.

aarondandy avatar Jan 09 '15 17:01 aarondandy

xbuild looks like it creates a temporary script file containing for example "bower install" and then it calls that script using an absolute path.

aarondandy avatar Jan 09 '15 18:01 aarondandy

I would propose the addition of a boolean property, like public bool SearchPath { get; set; } that will trigger logic that will search the PATH environment variable for the full location of the desired executable.

aarondandy avatar Feb 24 '15 22:02 aarondandy