From 870917bb36826acaf235907069b86e870d0bf295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Cast=C3=A9ran?= Date: Tue, 17 Dec 2024 14:25:24 +0100 Subject: [PATCH] fix(core): recreate io.Reader after read during file loading (#4363) --- core/arg_file_content.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/arg_file_content.go b/core/arg_file_content.go index 76385001de..d5d5f7a940 100644 --- a/core/arg_file_content.go +++ b/core/arg_file_content.go @@ -39,6 +39,10 @@ func loadArgsFileContent(cmd *Command, cmdArgs interface{}) error { } test := bytes.NewBuffer(content) v.Set(reflect.ValueOf(test)) + } else { + // Reader must be re-created as it can only be read once. + r := bytes.NewReader(b) + v.Set(reflect.ValueOf(r)) } case *string: if strings.HasPrefix(*i, "@") {