I'm surprised that that works on windows. Both select and signals are pretty unixy for the windows ports to emulate. I didn't know they could do that at all.
You're right that I omitted a way out of the while select loop. Probably last if 1 > $bytes; at the end of the loop would do it. I'll edit that into the original.
Update: Yes, concatenation in the loop would work fine, or if you wanted to get fancy I think you could say,
Or else you could use the offset argument of sysread to position at the end of $result.my $result; while (select my $rd = $rin, undef, undef, 60) { my $bytes = sysread *CMD, substr($result, -1), 4096; last if 1 > $bytes; }
The 60 second timeout is new, too. Adjust to taste.
After Compline,
Zaxo
In reply to Re^3: SIGINT and system calls
by Zaxo
in thread SIGINT and system calls
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |