Confusing results when calling run_task on undefined target
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When calling my $return = run_task $task, on => undef;, the value of $return is always 1.
(Originally reported by @sdondley via IRC, thanks!)
How to reproduce it
Steps to reproduce the behavior:
- Call
run_taskwithon => undef.
Shortest code example that demonstrates the bug:
task 'abc', sub {
return 'abc';
};
task 'run_task_undef', sub {
my $return = run_task 'abc', on => undef;
say $return;
};
Expected behavior
While a task's returned value might not be well-defined, it would be nice to have as consistent behavior as possible between the various calls. In this case, returning "abc" instead of 1.
Currently run_task $task, on => undef seems to execute on the same target as the calling task, which might be confusing and/or error-prone. Perhaps it's best to die() with an error message in this case.
Circumstances
- Rex version: current master
- Perl version: 5.32.0
- OS running rex: Gentoo
- OS managed by rex: Gentoo
- How rex was installed: dzil install
Debug log
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 with the minimal Perl reproduction in the issue and trace run_task when called with on => undef. Compare its return behavior with related task calls, then determine whether the intended result is a consistent returned value or an explicit error and add coverage for this case.
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
- 42/100