From: Christoph S. <csc...@am...> - 2006-12-27 09:28:48
|
I think sending an exit and let the objects clean itself is the cleanest way and could be also the fastest (the exit is performed more or less concurrently in all objects as the sending should be an async action). I'll try this. this is so simple, why didn't I think about it :-( BTW, why are you using Expect? You could execute the shell commands via qx'ssh'. Unless you're starting some interactive programs remotely... >> the applicaction depends on env variables which wouldn't be set in one-off shell commands (commands either don't work at all or behave differently. I did a wrapper to set the variables and performs the one off command, but I had to work around problems caused by starting application: the app contains deamons and when they are started in a one off ssh command with nohub, the ssh remains, as it wants all processes to stop prior end. As said this can be worked around with killing itself using different signals depending on the commands exit code - but this is nothing I have a good feeling with. Using expect is much cleaner as it uses an interactive ssh as a user would do (no difference to a human keyin what so ever). Thanks to you and Austin. Best Regards, Christoph Schwaiger "Roland Giersig" <rgi...@cp...> To exp...@li... cc bcc Subject Re: [Expectperl-discuss] speed up object close "Roland Giersig" <rgi...@cp...> Sent by: exp...@li... 23-12-06 17:44 I'll second Austins first approach: make the spawned commands exit cleanly. That means, send an "exit\r" or whatever is needed after you get the output from the remote commands. This will cause the remote side to close everything down and you will get an EOF and the spawned command will terminate and the close() will return immediately. BTW, why are you using Expect? You could execute the shell commands via qx'ssh'. Unless you're starting some interactive programs remotely... Regards, Roland PS: Frohe Weihnukka! :o) On 12/23/06, Austin Schutz <te...@of...> wrote: > On Fri, Dec 22, 2006 at 02:49:11PM +0100, Christoph Schwaiger wrote: > > Hello Austin, > > > > thanks for your answer. Currently, I'm already using hard_close, but > > wonder, due to the many objects I close sequentially, even hard_close > > takes too long. > > Would you have an idea how to speed the closure up? > > > you can always just kill(9, $expect->pid()); and then wait(); > > By default nothing does that because sending signals other than > 9 allows the process to clean itself up before exit. But that is the fastest > way to make sure it goes away _now_. In fact you can skip on the wait() if > you don't mind leaving zombies around until your perl process exits. > > Austin > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |