Truncate the logs when server process is starting

This commit is contained in:
Dane Everitt 2019-05-09 21:52:24 -07:00
parent 7a52e3a9c2
commit 9c252a5ad7
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -128,7 +128,11 @@ func (d *DockerEnvironment) Start() error {
return nil return nil
} }
opts := types.ContainerStartOptions{} // Truncate the log file so we don't end up outputting a bunch of useless log information
// to the websocket and whatnot.
if err := os.Truncate(c.LogPath, 0); err != nil {
return err
}
d.Server.Emit(StatusEvent, ProcessStartingState) d.Server.Emit(StatusEvent, ProcessStartingState)
@ -139,6 +143,7 @@ func (d *DockerEnvironment) Start() error {
return err return err
} }
opts := types.ContainerStartOptions{}
if err := d.Client.ContainerStart(context.Background(), d.Server.Uuid, opts); err != nil { if err := d.Client.ContainerStart(context.Background(), d.Server.Uuid, opts); err != nil {
d.Server.Emit(StatusEvent, ProcessOfflineState) d.Server.Emit(StatusEvent, ProcessOfflineState)
return err return err