microsoft / sudo

It's sudo, for Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unify command execution in sudo.ps1

shailist opened this issue · comments

Description of the new feature / enhancement

There are 3 places in the sudo.ps1 script that execute SUDOEXE in the following manner:

if (($psversiontable.psversion.major -eq 7) -and ($__SUDO_DEBUG -eq $true)) {
	Trace-Command -PSHOST -name param* -Expression { & $SUDOEXE ... }
}
else {
	& $SUDOEXE ...
}

Maybe export this logic to a function Run-Sudo or something along those lines?

Scenario when this would be used?

Any future change, bugfix, or improvement to the sudo executable or sudo script that need to be addressed at the points of command execution will only need to be applied in 1 place.

Supporting information

No response

Thanks for your feedback! I've added this to our backlog.