I need to issue some commands to the currently executing program and get the output of the current (remotely) executing program into some string in the script. The problem I am currently encountering is that I don't know the output of each command which output can also vary as it can be read from user.
e.g.
- ./my_program
- print_output_1 [ with in my_program ]
- print_output_2 [ with in my_program ]
- exit [ with in my_program ]
and if i run the commands manually terminal will get something like this
bash$ ./my_programe
my_program: print_output_1
my_program:first_line_printed_with_unknown_length
my_program: print_output_2
my_program:second_line_printed_with_unknown_length
my_program: exit
bash$
so i should get "first_line_printed_with_unknown_length" and "second_line_printed_with_unknown_length" in a python string like
execute(my_program)
str1 = execute( print_output_1 )
str2 = execute( print_output_2 )
val = execute( exit )
Python