stderr being printed out for Rex::Service instead of captured for $running_upstart
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
sh: initctl: not found gets printed out any time Rex::Service->get is called.
Expected behavior
Redirects stderr to stdout to avoid
How to reproduce it
perl -e 'use Rex::Commands::Service; service snmpd=>"start";'
sh: initctl: not found
sh: initctl: not found
[2024-01-22 22:37:29] INFO - Service snmpd started.
Code example
use Rex::Commands::Service;
service snmpd=>"start";
Additional context
So looks like Rex::Commands::Service->service calls Rex::Service->get to get the object to use for it. When this happen a bit of code is ran to test for OS and if initctl and systemctl are usable.
I am lost as to why the systemctl check does not also do it.
Likely the best option here is to add which initctl > /dev/null && before it and likely do the same with systemctl as well.
[root@nibbles0]1|/src/ports/head>which initctl > /dev/null && echo test
[root@nibbles0]1|/src/ports/head>which ls > /dev/null && echo test
test
[root@nibbles0]0|/src/ports/head>
Double check to make sure this issue is not caused by how it is being packaged and when reinstalled via cpanm --reinstall Rex the same thing happens.
Rex version
1.14.3
Perl version
v5.36.3
Operating system running rex
FreeBSD nibbles0.vulpes.vvelox.net 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64
Operating system managed by rex
FreeBSD and Linux
How rex was installed?
package manager
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Rex::Commands::Service->service and Rex::Service->get, then inspect the OS checks for initctl and systemctl described in the issue. Reproduce with the provided Perl service command on FreeBSD and verify that service lookup no longer prints the initctl stderr output while still reporting the service result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100