Parcourir la source

Merge pull request #14762 from LK4D4/lint_reexec

Add docstring to reexec.Command
Doug Davis il y a 10 ans
Parent
commit
4d0990a753

+ 4 - 0
pkg/reexec/command_linux.go

@@ -7,6 +7,10 @@ import (
 	"syscall"
 	"syscall"
 )
 )
 
 
+// Command returns *exec.Cmd which have Path as current binary. Also it setting
+// SysProcAttr.Pdeathsig to SIGTERM.
+// For example if current binary is "docker" at "/usr/bin", then cmd.Path will
+// be set to "/usr/bin/docker".
 func Command(args ...string) *exec.Cmd {
 func Command(args ...string) *exec.Cmd {
 	return &exec.Cmd{
 	return &exec.Cmd{
 		Path: Self(),
 		Path: Self(),

+ 1 - 0
pkg/reexec/command_unsupported.go

@@ -6,6 +6,7 @@ import (
 	"os/exec"
 	"os/exec"
 )
 )
 
 
+// Command is unsupported on operating systems apart from Linux and Windows.
 func Command(args ...string) *exec.Cmd {
 func Command(args ...string) *exec.Cmd {
 	return nil
 	return nil
 }
 }

+ 3 - 0
pkg/reexec/command_windows.go

@@ -6,6 +6,9 @@ import (
 	"os/exec"
 	"os/exec"
 )
 )
 
 
+// Command returns *exec.Cmd which have Path as current binary.
+// For example if current binary is "docker.exe" at "C:\", then cmd.Path will
+// be set to "C:\docker.exe".
 func Command(args ...string) *exec.Cmd {
 func Command(args ...string) *exec.Cmd {
 	return &exec.Cmd{
 	return &exec.Cmd{
 		Path: Self(),
 		Path: Self(),