Skip to content

Commit 06fa4b4

Browse files
committed
lib/bash.rb: allow passing custom returns to safe_grep
Bash.safe_grep hardcodes option returns to [0,1], which prevents callers from providing broader exit code acceptance (e.g. 2 for missing files). Update to conditionally set options[:returns] only if it is not already provided by the caller. Signed-off-by: Philip Li <philip.li@intel.com>
1 parent 18d0296 commit 06fa4b4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/bash.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run(*args, **options, &block)
7070
end
7171

7272
def safe_grep(*args, **options, &)
73-
options[:returns] = [0, 1]
73+
options[:returns] ||= [0, 1]
7474
run(*args, **options, &)
7575
end
7676

0 commit comments

Comments
 (0)