Relative Content

Tag Archive for pythonc++linuxshelllsf

How to stream the interactive shell of a remote program to stdout of a running c++ program that launched the remote program (using BSUB -I mode)

I have a C++ program (say, process P1) which, in its course of execution, spawns a new process P2 on a remote machine using a launcher like LSF. P2 has an interactive shell (could be python). I want the user at P1 to use this interactive shell of P2 for a while and then exit P2 when done. P1 continues from here and may spawn other interactive shells in future. All the while P1 either continued in the background or was blocked (does not matter at the moment). It is necessary that a local program like P1 only spawns P2 as it could spawn other processes based on certain conditions. Also, P1 could relaunch P2 in the event of P2 crashing. All the processes are running on Linux environment.
Launching bsub -Ip P2 using popen does not stream the shell of P2 to P1’s stdout. It just shows that the program was started on a certain machine.
If the streaming is not possible, is there an alternate way to handle such a scenario.