@@ -17,9 +17,9 @@ import (
1717)
1818
1919const (
20- cliCommandTimeout = 5 * time .Minute
21- maxCLIOutputBytes = 1024 * 1024
22- commandWaitDelay = 2 * time .Second
20+ cliCommandTimeout = 5 * time .Minute
21+ maxCLIOutputBytesPerStream = 1024 * 1024
22+ commandWaitDelay = 2 * time .Second
2323)
2424
2525var errCLIOutputLimitExceeded = errors .New ("CLI command output limit exceeded" )
@@ -63,14 +63,14 @@ func (b *boundedBuffer) Truncated() bool {
6363}
6464
6565func runCLICommand (command api.CLIStepCLICommand , variables map [string ]string ) (result api.CLICommandResult ) {
66- return runCLICommandWithLimits (command , variables , cliCommandTimeout , maxCLIOutputBytes )
66+ return runCLICommandWithLimits (command , variables , cliCommandTimeout , maxCLIOutputBytesPerStream )
6767}
6868
6969func runCLICommandWithLimits (
7070 command api.CLIStepCLICommand ,
7171 variables map [string ]string ,
7272 timeout time.Duration ,
73- maxOutputBytes int ,
73+ maxOutputBytesPerStream int ,
7474) (result api.CLICommandResult ) {
7575 finalCommand := InterpolateVariables (command .Command , variables )
7676 result .FinalCommand = finalCommand
@@ -94,8 +94,8 @@ func runCLICommandWithLimits(
9494 cancelForOutputLimit := func () {
9595 cancelCommand (errCLIOutputLimitExceeded )
9696 }
97- stdout := newBoundedBuffer (maxOutputBytes , cancelForOutputLimit )
98- stderr := newBoundedBuffer (maxOutputBytes , cancelForOutputLimit )
97+ stdout := newBoundedBuffer (maxOutputBytesPerStream , cancelForOutputLimit )
98+ stderr := newBoundedBuffer (maxOutputBytesPerStream , cancelForOutputLimit )
9999 cmd .Stdout = stdout
100100 cmd .Stderr = stderr
101101 err := cmd .Run ()
@@ -112,7 +112,7 @@ func runCLICommandWithLimits(
112112
113113 switch {
114114 case errors .Is (context .Cause (ctx ), errCLIOutputLimitExceeded ):
115- result .Err = fmt .Sprintf ("command output exceeded the %d-byte limit" , maxOutputBytes )
115+ result .Err = fmt .Sprintf ("command output exceeded the %d-byte per-stream limit" , maxOutputBytesPerStream )
116116 result .ExitCode = - 2
117117 case errors .Is (context .Cause (ctx ), context .DeadlineExceeded ):
118118 result .Err = fmt .Sprintf ("command timed out after %s" , timeout )
0 commit comments