Re: [webmin-devel] pty_process_exec

Jamie Cameron <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
On Tue, 2005-05-24 at 12:27, Tan Rezaei wrote:
> I am trying to get this to work but I get a "-1" as my $rv when I run it. I 
> am not sure what I am doing wrong.
> 
> 	&foreign_require("proc", "proc-lib.pl");
> 	($fh, $pid) = &proc::pty_process_exec("$driver -UR $pdline $sys $tab");
> 	while(1) {
> 		$rv = &wait_for($fh, "Are you sure you want to continue (Yy)\?");
> 		print $rv;
> 		if ($rv == 0) {
> 			print "Saying Yes";
> 			sysprint($fh, "y\n");
> 			}
> 		else {
> 			last;
> 			}
> 		}
> 	close($fh);
> 
> 
> And my prompt looks like this when I run the command from the terminal:
> 
> This option will also remove all of the data.
> Are you sure you want to continue (Yy)?
> 
> I need to type in "y" here and hit enter here.
> 
> I have also tried maney other patterns in place of "Are you sure you want to 
> continue (Yy)?"
> 
> I even tried just "\?" or "\\?" nothing seems to work.
> 
> Thanks for your help

You could try changing the wait_for call to something like :

$rv = &wait_for($fh, 'Are you sure you want to continue \(Yy\)\?');

Quoting the (, ) and ? characters is important, as the parameters to
wait_for are regular expressions.

 - Jamie






-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.