Subject: | close method should return command object, not reaper |
I expected to be able to do something like:
my $cmd = System::Command->new(@cmd)->close;
exit if 2 == ($cmd->signal // -1);
but close() returns the reaper object, instead of the command object. So I have to use an extra line for the call to close().
my $cmd = System::Command->new(@cmd);
$cmd->close;
exit if 2 == ($cmd->signal // -1);
The documentation doesn't even mention the return value of close(), so it wouldn't be breaking the api.
Is the user ever going to need to make use of the reaper directly? If not, I suggest close() returns the command object. And if the reaper is to be used, it can be exposed as an attribute.