Skip to content
Snippets Groups Projects

Fix home directory detection

Merged Tomasz Maczukin requested to merge fix-home-directory-finding-error into main
1 file
+ 1
5
Compare changes
  • Side-by-side
  • Inline
  • e440120b
    Fix home directory detection · e440120b
    Tomasz Maczukin authored
    With 452ac0a2 we changed how HOME
    directory detection and "fixing" is working, but now it's causing
    runner to fail in cases it didn't before.
    
    The change was done because previously we've been using a deprecated
    function from the `homedir` package. It was, however, done wrong.
    
    This commit reverts code to the previous version.
+ 1
5
@@ -13,11 +13,7 @@ func FixHOME(app *cli.App) {
app.Before = func(c *cli.Context) error {
// Fix home
key, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("failed to get user home dir: %w", err)
}
if os.Getenv(key) == "" {
if key := homedir.Key(); os.Getenv(key) == "" {
value := homedir.Get()
if value == "" {
return fmt.Errorf("the %q is not set", key)
Loading