rustyhorde / vergen

Generate cargo instructions at compile time in build scripts for use with the env! or option_env! macros
Apache License 2.0
392 stars 56 forks source link

Functions fail in gitcl when shell prints text in non-interactive mode #362

Open Jomosoto opened 2 months ago

Jomosoto commented 2 months ago

When the users shell is configured to print text even though it is ran non-interactively, some functions (like check_inside_git_worktree here) produce incorrect results. This happens because it parses the output of git commands, ran by executing $SHELL with -c [git command] (here). If the shell prints any additional text, the output is always invalid.

This may not count as a bug, as you can normally expect that shells don't print anything when ran non-interactively (especially as bash doesn't source the .bashrc when ran non-interactively), but in shells like fish where you have to actively decide what commands shouldn't be ran when non-interactive it can happen that users that never thought about this (including me before coming across this issue) print something anyways. (Leading to issues like: https://github.com/pop-os/cosmic-files/issues/250)