Skip to content

Commit 69defa6

Browse files
committed
Add exit status handling to generated bash function
1 parent fbd3ec5 commit 69defa6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Stecman/Component/Symfony/Console/BashCompletion/CompletionHandler.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,15 @@ public function generateBashCompletionHook($programName)
359359
return <<<"END"
360360
function $funcName {
361361
export COMP_CWORD COMP_KEY COMP_LINE COMP_POINT COMP_WORDBREAKS;
362-
COMPREPLY=(`compgen -W "$($command _completion)"`);
362+
363+
RESULT=`$command _completion`;
364+
STATUS=$?;
365+
if [ \$STATUS -ne 0 ]; then
366+
echo \$RESULT;
367+
exit $?;
368+
fi;
369+
370+
COMPREPLY=(`compgen -W "\$RESULT"`);
363371
};
364372
complete -F $funcName $programName;
365373
END;

0 commit comments

Comments
 (0)