Skip to content

Commit

Permalink
store also command logs
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadazmy committed Jun 28, 2021
1 parent 49bfb24 commit e931475
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/vm/ch.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ func (m *Machine) Run(ctx context.Context, socket, logs string) error {
cmd.ExtraFiles = append(cmd.ExtraFiles, tap)
}

out, err := os.Create(fmt.Sprintf("%s.out", logs))
if err != nil {
log.Error().Err(err).Msg("failed to create process log file")
} else {
cmd.Stdout = out
cmd.Stderr = out
defer out.Close()
}

defer func() {
for _, c := range toClose {
c.Close()
Expand Down

0 comments on commit e931475

Please sign in to comment.