Skip to content

Commit

Permalink
Added pkill and killall (#31)
Browse files Browse the repository at this point in the history
Fixes #21 

Adds no-op commands for `killall` and `pkill` like the existing `kill`.
These are some of the highest ranking missing commands with nearly 100
invocations each over the last couple of days.
  • Loading branch information
josephlewis42 authored Dec 24, 2023
1 parent dd47316 commit 41b0936
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
26 changes: 26 additions & 0 deletions commands/killall.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package commands

import (
"github.com/josephlewis42/honeyssh/core/vos"
)

// Killall implements a no-op killall command.
func Killall(virtOS vos.VOS) int {
cmd := &SimpleCommand{
Use: "killall [OPTION]... [--] NAME...",
Short: "Kill a process by name.",
// Never bail, even if args are bad.
NeverBail: true,
}

return cmd.Run(virtOS, func() int {
// No-op.
return 0
})
}

var _ vos.ProcessFunc = Killall

func init() {
addBinCmd("killall", Killall)
}
26 changes: 26 additions & 0 deletions commands/pkill.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package commands

import (
"github.com/josephlewis42/honeyssh/core/vos"
)

// Pkill implements a no-op pkill command.
func Pkill(virtOS vos.VOS) int {
cmd := &SimpleCommand{
Use: "pkill [OPTION]... PATTERN",
Short: "Signal a process by pattern",
// Never bail, even if args are bad.
NeverBail: true,
}

return cmd.Run(virtOS, func() int {
// No-op.
return 0
})
}

var _ vos.ProcessFunc = Pkill

func init() {
addBinCmd("pkill", Pkill)
}

0 comments on commit 41b0936

Please sign in to comment.