I am trying to run National Instruments TestStand Sequence Analyzer as part of a build in Azure DevOps using a Python script. Agent is running as a service.
import subprocess command = '"%teststand%\Bin\AnalyzerApp.exe" MyAnalyzerProject.tsaproj /analyze /report /save /quit' exit_code = subprocess.call(command, shell=True) print(exit_code) # returns the exit status
It works when I run it manually, but fails when agent tries to run it:
Unhandled Exception: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) at AnalyzerApp.e.a(String A_0, String A_1) at NationalInstruments.TestStand.Utility.LaunchTestStandApplicationInNewDomain.HandleLaunchProtectedException(Exception e, String applicationName, DisplayErrorMessageDelegate displayErrorMessage) at NationalInstruments.TestStand.Utility.LaunchTestStandApplicationInNewDomain.LaunchProtectedReturnCode(MainEntryPointDelegateWithArgsReturnCode entryPoint, String args, String applicationName, DisplayErrorMessageDelegate displayErrorMessage, Boolean parseArgs) at AnalyzerApp.e.b(String A_0)
I tried running it using cmd first, but depending on Agent service user it either gets stuck or throws an error -532462766 (0xE0434352) and writes a similar entry to event log.
There is no need for user interaction: normally dialog opens and closes when analysis is done. I am after the exit code and report file that it creates. Is there a way to get this to work?
This can be accomplished by running the agent interactively instead of as a service. It seems that the only dis-benefit of running interactively is a need for auto logon and associated security risk. More about service vs interactive can be found here.
User contributions licensed under CC BY-SA 3.0