Skip to content

Commit fa8ab6c

Browse files
committed
feat(sandbox): add stdin pipe support to exec command
- Add isPipedStdin() detection and sendStdinToSandbox() forwarding - Modify execForeground/execBackground to support piped stdin - Add pipe usage examples to exec command help - Upgrade go-sdk to v7.26.4 (WithStdin, CloseStdin support) - Remove replace directive for local go-sdk - Move cli_comparison.md to qbox/sandbox project
1 parent 4f258cf commit fa8ab6c

File tree

5 files changed

+57
-424
lines changed

5 files changed

+57
-424
lines changed

cmd/sandbox.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ var sandboxExecCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
344344
qshell sandbox exec sb-xxxxxxxxxxxx -- ls -la
345345
qshell sbx ex sb-xxxxxxxxxxxx -- ls -la
346346
347+
# Pipe stdin to a command
348+
echo "hello world" | qshell sbx ex sb-xxxxxxxxxxxx -- cat
349+
cat file.txt | qshell sbx ex sb-xxxxxxxxxxxx -- wc -l
350+
347351
# Run in background (print PID and return)
348352
qshell sandbox exec sb-xxxxxxxxxxxx -b -- python server.py
349353
qshell sbx ex sb-xxxxxxxxxxxx -b -- python server.py

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/fatih/color v1.18.0
1010
github.com/mitchellh/go-homedir v1.1.0
1111
github.com/muesli/termenv v0.16.0
12-
github.com/qiniu/go-sdk/v7 v7.26.3
12+
github.com/qiniu/go-sdk/v7 v7.26.4
1313
github.com/schollz/progressbar/v3 v3.8.6
1414
github.com/spf13/cast v1.3.1
1515
github.com/spf13/cobra v1.1.3
@@ -94,5 +94,3 @@ require (
9494
go 1.24.0
9595

9696
toolchain go1.24.1
97-
98-
replace github.com/qiniu/go-sdk/v7 => ../go-sdk

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z
334334
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
335335
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
336336
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
337-
github.com/qiniu/go-sdk/v7 v7.26.3 h1:fU2TuLDzV06lfo25NIDd396h9QT+u0kGlZA2Q3RxIrM=
338-
github.com/qiniu/go-sdk/v7 v7.26.3/go.mod h1:ri7fGwbio0pRDFr8EK5TUpx0DbnpIMJ2bMSDxGWfCbk=
337+
github.com/qiniu/go-sdk/v7 v7.26.4 h1:D/k6cPbhjKvSx9hVBQSh97GuPu1ZtM3OLPCclSpusjo=
338+
github.com/qiniu/go-sdk/v7 v7.26.4/go.mod h1:ri7fGwbio0pRDFr8EK5TUpx0DbnpIMJ2bMSDxGWfCbk=
339339
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
340340
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
341341
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=

0 commit comments

Comments
 (0)