How to spawn an already run process in expect script

I've already run a process, for example "fdisk /dev/sda" with the PID of "2000"

Now I execute expect script and I want expect to take control of stdin and stdout of my desired PID (2000) , so I can use "expect" and "send" command and interact with my process.

"spawn" command in expect normally create a process rather than connecting to it. but you can combine it with "open" command from tcl language but this command also opens files and some other things.

Any way to make this happen?

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like