# File: testwrapper.py # Date: 2-19-2017 # Description: A python test program that program that prints output from a subprocess. import subprocess import time def main(): launch_executable() def launch_executable(): """ Launches the command-line program """ print("Launch started") program_name = "top" # this can be any command that continually prints output list = [program_name] process = subprocess.Popen(list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) while process.poll() == None: print("subprocess still running") print("Value = " + process.stdout.readline()) time.sleep(0.1) print("Exit") if __name__ == "__main__": main()