-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: Correct kill command. Fixes #8687 Signed-off-by: Alex Collins <[email protected]> * fix: ok Signed-off-by: Alex Collins <[email protected]> * fix: ok Signed-off-by: Alex Collins <[email protected]>
- Loading branch information
Showing
7 changed files
with
63 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
"syscall" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewKillCommand() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "kill SIGNAL PID", | ||
SilenceUsage: true, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
signum, err := strconv.Atoi(args[0]) | ||
if err != nil { | ||
return err | ||
} | ||
pid, err := strconv.Atoi(args[1]) | ||
if err != nil { | ||
return err | ||
} | ||
sig := syscall.Signal(signum) | ||
p, err := os.FindProcess(pid) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Printf("killing %d with %v\n", pid, sig) | ||
if err := p.Signal(sig); err != nil { | ||
return err | ||
} | ||
return nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
test/e2e/testdata/sidecar-injected-kill-annotation-workflow.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters