shell completion command failed when cwd is local git repo
georgexsh opened this issue · 5 comments
I am using lab version 0.23.0, bash 5.1, steps to reproduce this issue:
- create a git repo without remote:
RAND=$RANDOM; mkdir /tmp/$RAND; cd /tmp/$RAND; git init
- run
source <(lab completion)
- got error:
2022/02/10: No such file or directory
lab completion
outputs a line of log to stdout
like 2022/02/10 13:07:32 root.go:205: No default remote found
, which bash's source
doesn't understand. I guess a possible solution is always output log to stderr
rather than stdout
, or bypass local git remote checking when the command is lab completion
.
@georgexsh thanks for the report!
And your suggestions are indeed correct. I'll check what fits better and prepare the PR.
@georgexsh #792 should solve the issue with lab completion
.
I'm going to close this issue.
But in case you see any other problems, please feel free to reopen it or open a new issue!
Many thanks for the report @georgexsh
@bmeneg the fix works, thanks! but I still wonder why the logs would be writing to stdout
.
@georgexsh That's a valid point: not sure why, but when I wrote the logs I let only the "error" level to be written to stderr, while others "info, warn and debug" would go stdout.
But yes, anything that isn't part of the program's standard output, shouldn't go to stdout.
I'm going to prepare another PR suggesting this change.