LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly use System Exec without being locked up in Labview ?

Solved!
Go to solution

Hello,

My application requires the use of System Exec with Minimized =True and Wait till completion =True. However, I found out that if the target executable spawns sub-processes and if the target executable crashes, the sub-processes will be zombies. In this case, the "System Exec" node will lock forever, until the zombie processes found and terminated by task manager. I cannot control the target executable and its behavior. What can I do to solve this issue ?

 

A side of question which may be a bit stretchy for Labview but this is very easy to do in other languages such as Java. Are there facilities in Labview that allow create asynchronous processes handles which return process ID at the minimum, also allow start/kill/check status operation, as well as attach input/output streams to those processes Smiley Happy

 

Thank you!

0 Kudos
Message 1 of 4
(2,666 Views)

"Start Asynchronous Call" under Application menu.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(2,638 Views)

Hi Yamaeda,

Thank you for your suggestion. I assumed you meant to use "Start Async Call" with "Labview process". I should have mentioned that the target executable and the processes it spawns are windows processes not a part of Labview environment. However, I bundled them in a intermediary VI and used Start Aync Call in such a way that the call did not block and the intermediary VI stopped. However, if the zombie processes remain they will remain. So I guess what I am asking is if there is a way to issue kill tree to the intermediary VI, thus all the child (windows) processes will be terminated ? I imagine it has to do with getting process ID, but I have never seen labview able to create a separate processes apart from the normal Labview.exe

0 Kudos
Message 3 of 4
(2,632 Views)
Solution
Accepted by topic author zigbee1

LabVIEW's execution system is internal to the host process; asynchronous calls in LabVIEW (and the multi-threaded system in general) are managed via the execution system abstraction that the runtime maintains. The LabVIEW development environment, and any LabVIEW executables you build with Application Builder, all host this runtime. LabVIEW never spawns a new Windows process unless an external API or a system call is used in your code.

 

Answering your first question I would suggest that you look at using .NET to start and control your processes. The Process class in the System.Diagnostics namespace would be the best place to start; the API allows you to start a process but not immediately wait for completion as well as control methods. It also has methods to find a process running on the machine and allow you to then control it (such as Kill). You could implement these in your intermediary VI(s) and you might not need to bother with Async Calls either. The current Windows user will need adequate permissions to perform these tasks since, under the covers, they call the same Win32 API as everything else.

0 Kudos
Message 4 of 4
(2,608 Views)