Last active
June 14, 2018 17:36
-
-
Save Keith-S-Thompson/3b8782a7a1dd6c385b7a5fe873ef8584 to your computer and use it in GitHub Desktop.
Test script for https://stackoverflow.com/q/50823740/827263
This file contains 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my %saved_env = %ENV; | |
my $term = $ENV{TERM}; | |
my $error_count = 0; | |
foreach my $var (sort keys %saved_env) { | |
%ENV = ( TERM => $term, $var => $saved_env{$var}); | |
my $lines = 0; | |
open my $PIPE, '-|', '/usr/bin/git', 'branch'; | |
while (<$PIPE>) { | |
$lines ++; | |
} | |
close $PIPE; | |
if ($lines == 0) { | |
print "$var=$ENV{$var} causes git branch to produce no output\n"; | |
$error_count ++; | |
} | |
} | |
if ($error_count == 0) { | |
print "No problem found\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment