Skip to content

Commit 1b95ade

Browse files
committed
fix: improve handling of ADC output for better logging and parsing
1 parent 91af37c commit 1b95ade

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/provider/adc/executor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ func (e *DefaultADCExecutor) buildCmdError(runErr error, stdout, stderr []byte)
112112

113113
func (e *DefaultADCExecutor) handleOutput(output []byte) error {
114114
var result adctypes.SyncResult
115-
if index := strings.IndexByte(string(output), '{'); index > 0 {
116-
log.Warnf("extra output: %s", string(output[:index]))
117-
output = output[index:]
115+
log.Debugf("adc output: %s", string(output))
116+
if lines := bytes.Split(output, []byte{'\n'}); len(lines) > 0 {
117+
output = lines[len(lines)-1]
118118
}
119119
if err := json.Unmarshal(output, &result); err != nil {
120120
log.Errorw("failed to unmarshal adc output",

0 commit comments

Comments
 (0)