Skip to content
Snippets Groups Projects
Commit e3c55875 authored by Eric Miller's avatar Eric Miller
Browse files

Preserve command array in cache_command to pass to run_command

parent 2150c6cf
No related branches found
No related tags found
No related merge requests found
...@@ -10,14 +10,16 @@ my %commhist; ...@@ -10,14 +10,16 @@ my %commhist;
my %commcache; my %commcache;
my %children; my %children;
sub cache_command($$) { sub cache_command {
my ($command, $expiry) = @_; my $expiry = pop;
my @command = @_;
my $command = join(" ", @command);
my $now = time; my $now = time;
if($commhist{$command}>$now) { if($commhist{$command}>$now) {
return $commcache{$command}; return $commcache{$command};
} }
$commcache{$command} = run_command($command); $commcache{$command} = run_command(@command);
$commhist{$command} = $now + $expiry; $commhist{$command} = $now + $expiry;
return $commcache{$command}; return $commcache{$command};
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment