From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec return codes

Solved!
Go to solution

Not really on the Windows side! Your WTTServer executable calls some c runtime functions with invalid parameters causing the C runtime function to throw an exception. So while the exception is thrown in the C runtime library it's your server app that does something wrong.

 

The big difference between when you call that executable from the command line versus with SystemExec is most likley the current working directory. The command line shell always sets that to the directory in which you are at that moment inside it. In LabVIEW this is the current directory for the process, which is initially set to the directory where LabVIEW.exe was started from but gets changed by various Windows APIs including the selected path in the File Dialog box when it is dismissed with a positive acknolledgment (the OK/Load/Save button).

 

To specify a specific directory as start directory for the new process through SystemExec you have to pass the according start path to it too.

Rolf Kalbermatter
My Blog
0 Kudos
Message 21 of 25
(1,284 Views)

hmm, if its the server .exe file, would you expect the failure to occur when running manually from a cmd prompt?   it works fine in that scenario which Is why i thought labview had something to do with it.

0 Kudos
Message 22 of 25
(1,278 Views)
Solution
Accepted by topic author Moogie

See my edit. It has nothing to do with LabVIEW other than that LabVIEW uses CreateProcess directly and also doesn't mess with its own current directory at all. The command shell will change it whenever you do a successful cd command to whatever directory you changed into (most likely the directory your executable is in when you start it). But SystemExec has an extra parameter to set the start path for the executable which will define it's own current directory. If you leave this empty the created executable will normally inherit the current directory of the process that called CreateProcess(), thus here LabVIEW.

 

You can make a check in the command shell: Go to a different directory than where your executable is and then start your executable with the absolute path. See if this causes any error.

Rolf Kalbermatter
My Blog
Message 23 of 25
(1,272 Views)

aahh, gotcha

 

that fixed it.

 

thanks

0 Kudos
Message 24 of 25
(1,266 Views)

I had this same problem.  I was using the system exec .vi to issue a JTAG programming command to an iMPACT executable.  It worked great for weeks, then all of the sudden stopped working, but only through Labview's System exec.vi; I could still run it manually bring up the command prompt.

 

Following the advice of adding "cmd /c " (no quotes) before the command into the labview system exec.vi, everything now works the way it used to.  Weird, but I'm happy it works now.

 

0 Kudos
Message 25 of 25
(967 Views)