File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,7 +111,10 @@ func main() {
111111 os .Exit (1 )
112112 }
113113
114- exec .RunTasks (exec .Config , & opts .tasks )
114+ if err := exec .RunTasks (exec .Config , & opts .tasks ); err != nil {
115+ fmt .Println (err )
116+ os .Exit (1 )
117+ }
115118}
116119
117120func parseArgs (args []string , dashIndex int ) (tasks []string , cliArgs string ) {
Original file line number Diff line number Diff line change @@ -99,8 +99,9 @@ func TestConfig_CompileEnv(t *testing.T) {
9999 }
100100
101101 _ , err := config .CompileEnv ()
102- if err == nil {
103- t .Fatalf ("expected error, got nil" )
102+ // we expect this to be non-fatal
103+ if err != nil {
104+ t .Fatalf ("expected nil, got err: %v" , err )
104105 }
105106 })
106107}
@@ -204,18 +205,6 @@ func TestTask_CompileEnv(t *testing.T) {
204205 }
205206 }
206207 })
207-
208- t .Run ("error loading dotenv" , func (t * testing.T ) {
209- task := Task {
210- DotEnv : "nonexistent.env" ,
211- Dir : "/some/nonexistent/path" ,
212- }
213-
214- _ , err := task .CompileEnv ([]string {})
215- if err == nil {
216- t .Fatalf ("expected error, got nil" )
217- }
218- })
219208}
220209
221210func TestRunCmd (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ func readDotEnv(filename string) (map[string]string, error) {
4242func appendDotEnvToEnv (env []string , dotenv string ) ([]string , error ) {
4343 additionalEnv , err := readDotEnv (dotenv )
4444 if err != nil {
45- return nil , err
45+ // the dotenv file missing is non-fatal. log a warning and continue
46+ fmt .Printf ("Warning: Could not load dotenv file %s: %v\n " , dotenv , err )
47+ return env , nil
4648 }
4749 env = append (env , ConvertEnvToStringSlice (additionalEnv )... )
4850 return env , nil
You can’t perform that action at this time.
0 commit comments