Skip to content

Commit 756620c

Browse files
glenscstecman
authored andcommitted
Fix variable scope and heredoc escaping issue in completion hook
1 parent 5606fc7 commit 756620c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CompletionHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,10 @@ public function generateBashCompletionHook($programName = null)
355355
return <<<"END"
356356
function $funcName {
357357
export COMP_LINE COMP_POINT COMP_WORDBREAKS;
358+
local RESULT STATUS;
358359
359360
RESULT=`$command _completion`;
360-
STATUS=$?;
361+
STATUS=\$?;
361362
362363
if [ \$STATUS -ne 0 ]; then
363364
echo \$RESULT;
@@ -394,4 +395,4 @@ public function addHandler(Completion $helper)
394395
{
395396
$this->helpers[] = $helper;
396397
}
397-
}
398+
}

0 commit comments

Comments
 (0)