mirror of
https://github.com/go-task/task.git
synced 2025-01-06 03:53:54 +02:00
Ensure the $HOME env is being set on Windows
This commit is contained in:
parent
5285ec23ae
commit
52028fc3bc
@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/go-task/task/v2"
|
||||
"github.com/go-task/task/v2/internal/args"
|
||||
_ "github.com/go-task/task/v2/internal/homefix"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
5
internal/homefix/homefix.go
Normal file
5
internal/homefix/homefix.go
Normal 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
|
15
internal/homefix/homefix_windows.go
Normal file
15
internal/homefix/homefix_windows.go
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-task/task/v2"
|
||||
_ "github.com/go-task/task/v2/internal/homefix"
|
||||
"github.com/go-task/task/v2/internal/taskfile"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
|
Loading…
Reference in New Issue
Block a user