[Gambas-user] allocating a pty in gambas

Rob sourceforge-raindog2 at ...94...
Tue Aug 10 00:49:33 CEST 2004


On Monday 09 August 2004 18:34, Laurent Carlier wrote:
> > Is there some way I can fake this using clever use of the
> > open and shell commands, process objects, etc. or am I gonna
> > have to write another perl helper app (which would call the
> > Perl builtin IO::Pty class)? ;)
> i've got the same prob while trying to run the su command.
> with shell or exec xommand the same error :
> su: must be run from a terminal

Here is the workaround I came up with this afternoon (yeah, it's 
a perl script ;) )  Put your su or whatever in place of my ssh 
and shell out to this perl script.  I am about 80% of the way to 
an actual (though locked to 80x25) terminal emulator now ;)

#!/usr/bin/perl
use Expect;
my $exp = new Expect;
my $command = "ssh somehost -l someuser";
$exp->spawn($command, @parameters)
    or die "Cannot spawn $command: $!\n";
$exp->log_stdout(0);
$exp->interact();

# end of script...

Rob





More information about the User mailing list