![]() |
| ||
| Popen3 Problem Hello everyone. I have created a sales system for my company. Basically you telnet to the system and enter your login name, password ... From there you can access the sales system. I am working on a feature to write reports for a certain area of the system. For this, I want it to just shell out to VIM (Vi iMproved). For this I will be using Popen3, so the telnet user can access the sytem. This is some example code I have ... ( I know its Ruby code, but I know that Popen3 is popular with Perl. I'm sure a Perl user can answer this question as it more than likely isn't a problem with the language itself. ) def runVimForReport( node_number, file_name ) This code works well, the user can access VIM just fine. There is only one problem ... When the user exits the program it continues to read/write to the process. It doesn't just simply exit the functions. How do I tell when a program has exited? I tried other programs and all are the same ... It just hangs. The user has to logout and log back in. Even when disconnecting the telnet session, the program is still running in the background. Is there a variable I can check in my loop to see if the program has exited? Thanks for all your help! - Matt |
| ||
| Re: Popen3 Problem I figured it out! It wasn't that the program wasn't exiting. Ruby didn't know how to handle a nil variable in my code. I changed my start_read function to: def start_read( stdout , stderr ) So, when the program exits the input becomes nil. After discovering that it is nil, I killed the other thread. Everything works great now. Thanks for nobody's help :) - Matt |
| All times are GMT -4. The time now is 10:47 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC