mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
pkg/pidfile: remove PIDFile type, rename New() to Write()
This type felt really redundant; `pidfile.New()` takes the path of the file to create as an argument, so this is already known. The only thing the PIDFile type provided was a `Remove()` method, which was just calling `os.Remove()` on the path of the file. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -139,13 +139,12 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
|
||||
potentiallyUnderRuntimeDir := []string{cli.Config.ExecRoot}
|
||||
|
||||
if cli.Pidfile != "" {
|
||||
pf, err := pidfile.New(cli.Pidfile)
|
||||
if err != nil {
|
||||
if err := pidfile.Write(cli.Pidfile); err != nil {
|
||||
return errors.Wrap(err, "failed to start daemon")
|
||||
}
|
||||
potentiallyUnderRuntimeDir = append(potentiallyUnderRuntimeDir, cli.Pidfile)
|
||||
defer func() {
|
||||
if err := pf.Remove(); err != nil {
|
||||
if err := os.Remove(cli.Pidfile); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user