diff --git a/internal/pkg/entrypoint/entrypoint.go b/internal/pkg/entrypoint/entrypoint.go index 2655b610f..f48a8f10b 100644 --- a/internal/pkg/entrypoint/entrypoint.go +++ b/internal/pkg/entrypoint/entrypoint.go @@ -53,7 +53,7 @@ func Main() MainReturn { options, recordTransformers, err := climain.ParseCommandLine(os.Args) if err != nil { - fmt.Fprintln(os.Stderr, os.Args[0], ": ", err) + fmt.Fprintln(os.Stderr, "mlr:", err) os.Exit(1) } diff --git a/internal/pkg/lib/time.go b/internal/pkg/lib/time.go index 815c3bf9b..94c31c327 100644 --- a/internal/pkg/lib/time.go +++ b/internal/pkg/lib/time.go @@ -16,9 +16,10 @@ import ( // platform this is necessary for *changing* TZ mid-process: e.g. if a DSL // statement does 'ENV["TZ"] = Asia/Istanbul'. func SetTZFromEnv() error { - location, err := time.LoadLocation(os.Getenv("TZ")) + tzenv := os.Getenv("TZ") + location, err := time.LoadLocation(tzenv) if err != nil { - return err + return fmt.Errorf("TZ environment variable appears malformed: \"%s\"", tzenv) } time.Local = location return nil diff --git a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/cmd b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/cmd new file mode 100644 index 000000000..e7564a54a --- /dev/null +++ b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/cmd @@ -0,0 +1 @@ +mlr --tz .../... -n put -f test/input/sec2localtime-tz.mlr diff --git a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/experr b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/experr new file mode 100644 index 000000000..53e67a008 --- /dev/null +++ b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/experr @@ -0,0 +1 @@ +mlr: TZ environment variable appears malformed: ".../..." diff --git a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/expout b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/expout new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/should-fail b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone-2/should-fail new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone/experr b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone/experr index fc9d9179d..62865a004 100644 --- a/test/cases/dsl-local-date-time-functions/not-a-valid-timezone/experr +++ b/test/cases/dsl-local-date-time-functions/not-a-valid-timezone/experr @@ -1 +1 @@ -${MLR} : unknown time zone this-is-not-a-valid-timezone-name +mlr: TZ environment variable appears malformed: "this-is-not-a-valid-timezone-name"