Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from ingrammicro/master
Browse files Browse the repository at this point in the history
Master2Develop
  • Loading branch information
jrguerrero authored Aug 16, 2022
2 parents 9bc2f41 + c88b288 commit fff2c4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions utils/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ func RunTracedCmd(

// thresholdTime > 0 continuous report
// thresholdLines > 0 bootstrapping
func RunContinuousCmd(fn func(chunk string) error, command string, thresholdTime int, thresholdLines int) (int, error) {
func RunContinuousCmd(
report func(chunk string) error,
command string,
thresholdTime int,
thresholdLines int) (int, error) {

log.Debug("RunContinuousCmd")

// Saves script/command in a temp file
Expand Down Expand Up @@ -298,7 +303,7 @@ func RunContinuousCmd(fn func(chunk string) error, command string, thresholdTime
nLines++
nTime = int(time.Since(timeStart).Seconds())
if (thresholdTime > 0 && nTime >= thresholdTime) || (thresholdLines > 0 && nLines >= thresholdLines) {
if err := fn(chunk); err == nil {
if reportErr := report(chunk); reportErr == nil {
chunk = ""
}
nLines, nTime = 0, 0
Expand All @@ -313,7 +318,7 @@ func RunContinuousCmd(fn func(chunk string) error, command string, thresholdTime

if len(chunk) > 0 {
log.Debug("Processing the last pending chunk")
if err := fn(chunk); err != nil {
if err := report(chunk); err != nil {
log.Error("Cannot process the last chunk", err.Error())
}
}
Expand Down
2 changes: 1 addition & 1 deletion utils/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package utils

// VERSION sets the current CLI version
const VERSION = "0.15.0-alpha.1"
const VERSION = "0.15.0"

// VERSION_API_USER_MODE sets the current IMCO API version for user mode
const VERSION_API_USER_MODE = "v3"

0 comments on commit fff2c4a

Please sign in to comment.