Created
September 22, 2016 14:05
-
-
Save amaslenn/06fdaf68b5cfe9f047af7bcff82af579 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run external cmd and dump its output in ~realtime | |
sub run_or_die { | |
my $cmd = shift; | |
local $| = 1; | |
say "[cmd]: $cmd"; | |
open my $hp, "$cmd |" or die "$!\n"; | |
while (<$hp>) { | |
s/\r|\n//g; | |
say; | |
} | |
close $hp; | |
die "[$?] $!\n" if $? >> 8; | |
say ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment