Avoid race condition when listing matches (#238)

This commit is contained in:
silenc3r authored and GitHub committed 2020-03-06 01:04:58 -05:00
1 parent 9723bc0669
commit 6586b61384
1 file changed
+3 -3
+3 -3
View File
@@ -147,15 +147,15 @@ _z() {
function output(matches, best_match, common) {
# list or return the desired directory
if( list ) {
if( common ) {
printf "%-10s %s\n", "common:", common > "/dev/stderr"
}
cmd = "sort -n >&2"
for( x in matches ) {
if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
}
}
if( common ) {
printf "%-10s %s\n", "common:", common > "/dev/stderr"
}
} else {
if( common ) best_match = common
print best_match