diff --git a/cmd/cp-main.go b/cmd/cp-main.go index d03217d2..f040ba61 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -338,9 +338,19 @@ func doCopySession(session *sessionV8) error { gracefulStop() return } + + if e := urlScanner.Err(); e != nil { + // Error while reading. quit immediately + gracefulStop() + return + } + var cpURLs URLs // Unmarshal copyURLs from each line. - json.Unmarshal([]byte(urlScanner.Text()), &cpURLs) + if e := json.Unmarshal([]byte(urlScanner.Text()), &cpURLs); e != nil { + errorIf(probe.NewError(e), "Unable to unmarshal %s", urlScanner.Text()) + continue + } // Save total count. cpURLs.TotalCount = session.Header.TotalObjects