Avoid race condition when listing matches (#238)
This commit is contained in:
1 parent
9723bc0669
commit
6586b61384
1 file changed
+3
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user