mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-06 19:07:13 +00:00
add readline_nointr to Tools
this is a wrapper to have an uninterruptible readline so that we can read e.g. from a pipe even if interrupted by a signal Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
3496d4bf4d
commit
e03a836591
@ -1596,4 +1596,16 @@ sub convert_size {
|
||||
return int($value);
|
||||
}
|
||||
|
||||
# uninterruptible readline
|
||||
# retries on EINTR
|
||||
sub readline_nointr {
|
||||
my ($fh) = @_;
|
||||
my $line;
|
||||
while (1) {
|
||||
$line = <$fh>;
|
||||
last if defined($line) || ($! != EINTR);
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user