mirror of
https://git.sr.ht/~phw/scotty
synced 2025-06-05 04:58:33 +02:00
If dump does no write to file, output the result as log
This commit is contained in:
parent
312d9860cf
commit
4da5697435
10 changed files with 29 additions and 15 deletions
|
@ -73,14 +73,17 @@ func (b *DumpBackend) InitConfig(config *config.ServiceConfig) error {
|
|||
|
||||
func (b *DumpBackend) StartImport() error { return nil }
|
||||
|
||||
func (b *DumpBackend) FinishImport() error {
|
||||
func (b *DumpBackend) FinishImport(result *models.ImportResult) error {
|
||||
if b.print {
|
||||
out := new(strings.Builder)
|
||||
_, err := io.Copy(out, b.buffer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(out.String())
|
||||
|
||||
if result != nil {
|
||||
result.Log(models.Output, out.String())
|
||||
}
|
||||
}
|
||||
|
||||
// Close the io writer if it is closable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue