12-15-2020 10:24 AM
Let's say I have a bit of shell code I'm running with System Exec.vi that takes a while to complete (several seconds to a minute). My program needs the output of this shell code, so we can't simply run it entirely in the background (unless I'm missing some way to asynchronously collect the stdout). In an event driven program, if the user wants to close the program, this shell code should be stopped, but currently it cannot be stopped while also collecting the output from stdout.
Thoughts?
Solved! Go to Solution.
12-15-2020 10:25 AM
And yes, I'm aware of taskkill, but that seems like a blunt hammer in comparison to a proper PID/signal oriented approach, especially in the cases that you accidentally axe some other process that happens to be running under the same shell.
12-15-2020 10:27 AM
Ideally it would work like the `subprocess.Popen` style of external async calls like you have in Python
12-15-2020 12:03 PM - edited 12-15-2020 12:20 PM
@ijustlovemath wrote:
My program needs the output of this shell code, so we can't simply run it entirely in the background (unless I'm missing some way to asynchronously collect the stdout).
There is a .NET way of getting stdout. I found it on the forums once and used it, but I could not find it again when I looked recently. But it does exist.
Edit: might have been this one here: https://forums.ni.com/t5/LabVIEW/Real-time-Command-Line-Interface-System-Exec/m-p/3183320/highlight/...