lua: revert stdin check

This commit is contained in:
Meo597
2026-10-15 18:32:34 +08:00
parent 03ee3f872f
commit bba0ae39d1
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ func ConfigLoader(arg string) (out io.Reader, err error) {
data, err = FetchHTTPContent(arg)
case arg == "stdin:":
data, err = readConfigFile(os.Stdin)
data, err = io.ReadAll(os.Stdin)
default:
file, openErr := os.Open(arg)
+4 -1
View File
@@ -52,7 +52,7 @@ func TestRunConfigCommands(t *testing.T) {
{"merged source", []string{"run", "-test", "-format", "json", "-c", config, "-c", script}, 23, nil},
{"dump", []string{"run", "-dump", "-c", config}, 0, nil},
{"stdin pipe", []string{"run", "-test", "-c", "stdin:"}, 0, nil},
{"stdin file", []string{"run", "-test", "-c", "stdin:"}, 23, file},
{"stdin file", []string{"run", "-test", "-c", "stdin:"}, 0, file},
{"convert json", []string{"convert", "json", message}, 0, nil},
{"convert pb", []string{"convert", "pb", "-debug", config}, 0, nil},
{"convert pb stdin", []string{"convert", "pb", "-debug", "stdin:"}, 0, file},
@@ -65,6 +65,9 @@ func TestRunConfigCommands(t *testing.T) {
cmd.Env = append(os.Environ(), "XRAY_TEST_CONFIG_COMMAND=1")
cmd.Stdin = strings.NewReader("{}")
if tc.input != nil {
if _, err := file.Seek(0, io.SeekStart); err != nil {
t.Fatal(err)
}
cmd.Stdin = tc.input
}
output, err := cmd.CombinedOutput()