(ctx *core.Context)
| 52 | } |
| 53 | |
| 54 | func (m *Save) saveToDisk(ctx *core.Context) error { |
| 55 | root := filepath.Join(m.SaveFolder, fmt.Sprintf( |
| 56 | "%s_%s", |
| 57 | ctx.Execution.Date.Format("20060102_150405"), ctx.Job.GetName(), |
| 58 | )) |
| 59 | |
| 60 | e := ctx.Execution |
| 61 | err := m.writeFile(e.ErrorStream.Bytes(), fmt.Sprintf("%s.stderr.log", root)) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | |
| 66 | err = m.writeFile(e.OutputStream.Bytes(), fmt.Sprintf("%s.stdout.log", root)) |
| 67 | if err != nil { |
| 68 | return err |
| 69 | } |
| 70 | |
| 71 | err = m.saveContextToDisk(ctx, fmt.Sprintf("%s.json", root)) |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | func (m *Save) saveContextToDisk(ctx *core.Context, filename string) error { |
| 80 | js, _ := json.MarshalIndent(map[string]interface{}{ |
no test coverage detected