Skip to content

Commit c862d1d

Browse files
authored
pkg/storage: expose os.Stderr's Close and ReadAt methods (#6338)
StdinEngine.Get wraps os.Stderr with io.NopCloser and notSupportedReaderAt to hide its Close and ReadAt methods. This doesn't appear to be necessary, and exposing ReadAt enables reading CSUP and Parquet files from standard input.
1 parent aeab04e commit c862d1d

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

pkg/storage/stdio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (*StdioEngine) Get(_ context.Context, u *URI) (Reader, error) {
2020
if u.Scheme != "stdio" || (u.Path != "stdin" && u.Path != "") {
2121
return nil, fmt.Errorf("cannot read from %q", u)
2222
}
23-
return &notSupportedReaderAt{io.NopCloser(os.Stdin)}, nil
23+
return os.Stdin, nil
2424
}
2525

2626
func (*StdioEngine) Put(ctx context.Context, u *URI) (io.WriteCloser, error) {

sio/anyio/ztests/csup.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
script: |
22
super -f csup -o f -
33
super -s f
4+
echo // standard input
5+
super -s -c 'from "stdio:stdin"' < f
46
57
inputs:
68
- name: stdin
7-
data: &stdin |
9+
data: |
810
{a:1}
911
1012
outputs:
1113
- name: stdout
12-
data: *stdin
14+
data: |
15+
{a:1}
16+
// standard input
17+
{a:1}

sio/anyio/ztests/parquet.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
script: |
22
super -f parquet -o f -
33
super -s f
4+
echo // standard input
5+
super -s -c 'from "stdio:stdin"' < f
46
57
inputs:
68
- name: stdin
7-
data: &stdin |
9+
data: |
810
{a:1}
911
1012
outputs:
1113
- name: stdout
12-
data: *stdin
14+
data: |
15+
{a:1}
16+
// standard input
17+
{a:1}

0 commit comments

Comments
 (0)