...
|
...
|
@@ -356,7 +356,10 @@ func (container *Container) releaseNetwork() error {
|
356
|
356
|
func (container *Container) monitor() {
|
357
|
357
|
// Wait for the program to exit
|
358
|
358
|
Debugf("Waiting for process")
|
359
|
|
- container.cmd.Wait()
|
|
359
|
+ if err := container.cmd.Wait(); err != nil {
|
|
360
|
+ // Discard the error as any signals or non 0 returns will generate an error
|
|
361
|
+ Debugf("%s: Process: %s", container.Id, err)
|
|
362
|
+ }
|
360
|
363
|
Debugf("Process finished")
|
361
|
364
|
|
362
|
365
|
exitCode := container.cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
...
|
...
|
@@ -365,8 +368,12 @@ func (container *Container) monitor() {
|
365
|
365
|
if err := container.releaseNetwork(); err != nil {
|
366
|
366
|
log.Printf("%v: Failed to release network: %v", container.Id, err)
|
367
|
367
|
}
|
368
|
|
- container.stdout.Close()
|
369
|
|
- container.stderr.Close()
|
|
368
|
+ if err := container.stdout.Close(); err != nil {
|
|
369
|
+ Debugf("%s: Error close stdout: %s", container.Id, err)
|
|
370
|
+ }
|
|
371
|
+ if err := container.stderr.Close(); err != nil {
|
|
372
|
+ Debugf("%s: Error close stderr: %s", container.Id, err)
|
|
373
|
+ }
|
370
|
374
|
if err := container.Unmount(); err != nil {
|
371
|
375
|
log.Printf("%v: Failed to umount filesystem: %v", container.Id, err)
|
372
|
376
|
}
|
...
|
...
|
@@ -378,7 +385,9 @@ func (container *Container) monitor() {
|
378
|
378
|
|
379
|
379
|
// Report status back
|
380
|
380
|
container.State.setStopped(exitCode)
|
381
|
|
- container.ToDisk()
|
|
381
|
+ if err := container.ToDisk(); err != nil {
|
|
382
|
+ log.Printf("%s: Failed to dump configuration to the disk: %s", container.Id, err)
|
|
383
|
+ }
|
382
|
384
|
}
|
383
|
385
|
|
384
|
386
|
func (container *Container) kill() error {
|