1
0
mirror of https://github.com/go-task/task.git synced 2025-11-06 09:09:13 +02:00

Ensure the $HOME env is being set on Windows

This commit is contained in:
Andrey Nering
2019-09-07 14:28:36 -03:00
parent 5285ec23ae
commit 52028fc3bc
4 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
// Package homefix exists to address a bug where mvdan.cc/sh expects
// $HOME to be available in order to be able to expand "~".
//
// This should delete this package once this is fixed there.
package homefix

View File

@@ -0,0 +1,15 @@
package homefix
import (
"os"
"github.com/mitchellh/go-homedir"
)
func init() {
if os.Getenv("HOME") == "" {
if home, err := homedir.Dir(); err == nil {
os.Setenv("HOME", home)
}
}
}