ExecCommand() now display 'file not found' if the path not exist

This commit is contained in:
Yorick Barbanneau 2018-03-28 21:40:15 +02:00
parent 47329ea298
commit fca51612cd

View file

@ -523,6 +523,7 @@ function DelFile {
write-Host -ForegroundColor DarkRed $Error[0].Exception.Message write-Host -ForegroundColor DarkRed $Error[0].Exception.Message
} }
} }
function ExecCommand { function ExecCommand {
param ( param (
[cmdletbinding( [cmdletbinding(
@ -539,7 +540,7 @@ function ExecCommand {
$args = $params.arguments.Replace("##mod_path##", $script:current_module_path) $args = $params.arguments.Replace("##mod_path##", $script:current_module_path)
Write-Host -NoNewline "`tExecute : $path : " Write-Host -NoNewline "`tExecute : $path : "
$path = Invoke-Expression """$($path)""" $path = Invoke-Expression """$($path)"""
if ( -not (Test-Path $path) -and -not $path -eq "powershell" ) { if ( -not (Test-Path $path) -or -not $path -eq "powershell" ) {
Write-Host -ForegroundColor Yellow "File not found" Write-Host -ForegroundColor Yellow "File not found"
return return
} }