[pve-devel] how does errfunc in run_command exactly work?

Stefan Priebe - Profihost AG s.priebe at profihost.ag
Fri May 31 08:31:18 CEST 2013


Am 31.05.2013 07:43, schrieb Dietmar Maurer:
>>      eval {
>>          run_command($cmd, errmsg => "rbd error", errfunc => sub { }, outfunc
>> => $parser);
>>      };
>>      my $err = $@;
>>
>> ====>    under which circumstances does run_command die? errorcode != 0?
>>
>>      die $err if $err && $err !~ m/doesn't contain rbd images/ ;
>>
>> Where does this content $@ comes from? errfunc does nothing...
> 
> The important thing here is:
> 
> Parameter: errmsg => "rbd error"
> 
> This records the last string from 'stderr', and use that string for the exception if errorcode != 0.
> 

So the content or errmsg => is irrelevant? So if errmsg is set it means
save the last line of stderr and die with it if exitcode != 0?

Sorry jsut want to be sure how it works.

Stefan



More information about the pve-devel mailing list