зеркало из https://github.com/mozilla/gecko-dev.git
Cache the Term::ReadLine input device. On some systems, it has to be cached, otherwise you end up trying to open too many input handles or something like that. This also means we can have session history where available.
This commit is contained in:
Родитель
8ffd16f0b1
Коммит
78a7589fdc
|
@ -100,10 +100,9 @@ sub createArgument {
|
|||
} else {
|
||||
$self->app->output->request(@_);
|
||||
# get input from user
|
||||
my $term = Term::ReadLine->new($self->app->name);
|
||||
my $term = $self->term();
|
||||
my $value = $term->readline(''); # (the parameter passed is the prompt, if any)
|
||||
# if we cached the input device:
|
||||
# $term->addhistory($value);
|
||||
$term->addhistory($value);
|
||||
if (defined($value)) {
|
||||
if ($value eq '') {
|
||||
# use default
|
||||
|
@ -120,6 +119,15 @@ sub createArgument {
|
|||
}
|
||||
}
|
||||
|
||||
# internal method: returns a Term::ReadLine interface
|
||||
sub term {
|
||||
my $self = shift;
|
||||
if (not defined($self->{'term'})) {
|
||||
$self->{'term'} = Term::ReadLine->new($self->app->name);
|
||||
}
|
||||
return $self->{'term'};
|
||||
}
|
||||
|
||||
|
||||
# XXX Grrrr:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче