RexOps / RexOps/Rex

killall command fails with: no can_run function in Process.pm

Open
#1,548 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Running killall command on a FreeBSD server results in:

ERROR - Undefined subroutine &Rex::Commands::Process::can_run called

at /home/regular/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0/Rex/Commands/Process.pm line 85.

killall is defined as follows:

sub killall {
  my ( $process, $sig ) = @_;
  $sig ||= "";

  if ( can_run("killall") ) {
    i_run( "killall $sig $process", fail_ok => 1 );
    if ( $? != 0 ) {
      die("Error killing $process");
    }
  }
  else {
    die("Can't execute killall.");
  }
}

Seems like there's no can_run function in Process.pm module.

Expected behavior

killing process by name successfully

How to reproduce it

Run the code example.

Code example
task "kill_top", sub {
  killall "top";
};
Additional context

I tested, and the same error occured locally on Debian Linux as well.

Rex version

1.13.4

Perl version

5.36.0

Operating system running rex

Debian

Operating system managed by rex

FreeBSD

How rex was installed?

cpan client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Rex/Commands/Process.pm at the killall implementation and reproduce the reported failure with the provided task example. Verify that killall can execute successfully and terminate a named process on the reported environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.