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 <alex_collins@intuit.com> * fix: ok Signed-off-by: Alex Collins <alex_collins@intuit.com> * fix: ok Signed-off-by: Alex Collins <alex_collins@intuit.com> Signed-off-by: Saravanan Balasubramanian <sarabala1979@gmail.com>
- Loading branch information
1 parent
e85c815
commit ef3fb42
Showing
6 changed files
with
64 additions
and
39 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