LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System exec freezes/kills main vi because of wait until completion

Hi,

 

I have a problem where in my main VI I am using a subVI to open a third party application through cmd, let it run and then close it with another call to the system exec.vi. The problem I am having is that once it kills the application, it gets stuck in this subVI for some reason. Because this subvi contains third party applications and files I can not share I will leave a screenshot. Does anybody have any idea if there is something I'm missing? It feels like there is something I am doing wrong fundamentally with the calls to system exec.vi

 

Asasafuchi_2-1748326883001.png

 

 

 

 

0 Kudos
Message 1 of 4
(157 Views)

I have no time to do some tests, but did you try launching the external app without the wait until completion flag?

It does not seem mandatory, since the lifetime of the vi execution is fully determined by the loop.

As a side note, the outer loop would never stop if for some reasons the .smp2 file is not created or does not grow the expected size. I think you should address this possible event too.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 4
(151 Views)

Thanks! That seemed to do the trick

0 Kudos
Message 3 of 4
(116 Views)

In addition to what has been said, there is significant room for improvement.

 

  • The entire command creation on the upper left could be replaced by a single "format into string"
  • The inner while loop must be a a FOR loop. You can enable the conditional terminal to stop early.
  • Instead of scrubbing the error, you could just wire to the next structure to avoid automatic error handling
  • You can make one case "-1" and the other "default", no need to compare with -1.
  • The entire code feels fragile and overly complicated. For example you could wire a pattern of *.smtp2" to the "list folder" function, eliminating the entire inner loop, right?
  • etc. etc.

(.Hard to give more specific advice without seeing the VI and have the full requirements document.)

0 Kudos
Message 4 of 4
(85 Views)