Jun-07-2020, 07:49 AM
Hello you all:
I have a question with which approach and resources I have to make the following task:
There is a script in my Ubuntu machine that is called act.py, when act.py runs it performs a few tasks and while performing them, the process has a input() function to wait for operator/user input to continue the task.
My goal is to run a script named main.py that makes processes that executes act.py, when input() raised, the main.py will get notified (which is monitoring whole processes) and let me control the act.py (process) I chose or which raised a flag.
What I tried:
I tried pty.openpty() function which returns me master,slave(fd) but I can't make the terminal take over that fd and interact with it.
fork() will duplicate my master which is really not needed in my opinion.
Using pexpect is easy solution but I can't learn from it where my goal is really study how to get to level where I can control -> take over shells.
Could not really make combination of pty/tty/termios hope someone can clarify what is the best approach addressing this task.
I hope someone can help me with this as I am very enthusiast solving this as it's a big project for my college.
Thank's a lot for helpers.
I have a question with which approach and resources I have to make the following task:
There is a script in my Ubuntu machine that is called act.py, when act.py runs it performs a few tasks and while performing them, the process has a input() function to wait for operator/user input to continue the task.
My goal is to run a script named main.py that makes processes that executes act.py, when input() raised, the main.py will get notified (which is monitoring whole processes) and let me control the act.py (process) I chose or which raised a flag.
What I tried:
I tried pty.openpty() function which returns me master,slave(fd) but I can't make the terminal take over that fd and interact with it.
fork() will duplicate my master which is really not needed in my opinion.
Using pexpect is easy solution but I can't learn from it where my goal is really study how to get to level where I can control -> take over shells.
Could not really make combination of pty/tty/termios hope someone can clarify what is the best approach addressing this task.
I hope someone can help me with this as I am very enthusiast solving this as it's a big project for my college.
Thank's a lot for helpers.