Path testing was wrong

This commit is contained in:
Yorick Barbanneau 2018-04-11 22:29:18 +02:00
parent 2d9dc9743b
commit 37bb194595

View file

@ -592,17 +592,18 @@ function ExecCommand {
$args = $params.arguments.Replace("##mod_path##", $script:current_module_path)
Write-Host -NoNewline "`tExecute : $path : "
$path = Invoke-Expression """$($path)"""
if ( -not (Test-Path $path) -and -not $path -eq "powershell" ) {
if ( -not ((Test-Path $path) -or $path -eq "powershell") ) {
Write-Host -ForegroundColor Yellow "File not found"
return
return
}
try {
Start-Process -NoNewWindow -wait -filepath $path -ArgumentList $args
}
catch {
Write-Host -NoNewLine -ForegroundColor Red "Error`n`t"
write-Host -ForegroundColor DarkRed $Error[0].Exception.Message
Write-Host -ForegroundColor DarkRed $Error[0].Exception.Message
}
Write-Host "`n"
}
function ProcessModuleFile {