Fixes dos line separator issue when reading expression file #1860

This commit is contained in:
Mike Farah
2023-11-10 09:34:01 +11:00
parent b75dc0782b
commit 79a50b9c20
2 changed files with 14 additions and 1 deletions
+3 -1
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"strings"
"github.com/mikefarah/yq/v4/pkg/yqlib"
"github.com/spf13/cobra"
@@ -256,7 +257,8 @@ func processArgs(originalArgs []string) (string, []string, error) {
if err != nil {
return "", nil, err
}
expression = string(expressionBytes)
//replace \r\n (windows) with good ol' unix file endings.
expression = strings.ReplaceAll(string(expressionBytes), "\r\n", "\n")
}
args := processStdInArgs(originalArgs)