Rework message output for ExecCommand()

This commit is contained in:
Yorick Barbanneau 2018-04-12 00:57:00 +02:00
parent 10eecf17f5
commit 5e9148b111

View file

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