Getting $LastExitCode in PowerShell when invoking Visual Build using PowerShell -
i want invoke visualbuild build powershell , it's last exit code.
i invoke build using.
start-process -filepath $visualbuild -argumentlist "/b somescript.bld" -passthru -nonewwindow
i tried using try catch mechanism lead lastexitcode 0 if build failed.
when using like
$buildprocess = start-process -filepath $visualbuild -argumentlist "/b somescript.bld" -passthru -nonewwindow write-host "$($buildprocess.exitcode)"
my script get's stuck after executing , displaying build has failed output of lastexitcode never displayed.
the $visualbuild variable holds full path visbuildcmd.exe
i think need last exit code after command , store in variable:
start-process -filepath $visualbuild -argumentlist "/b somescript.bld" -passthru -nonewwindow $mylastexitcode = $lastexitcode write-host "lastexitcode: $mylastexitcode"
i have had previous issues ran command before displayed last exit code , 0
. might similar issue.
Comments
Post a Comment