You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by ti...@apache.org on 2026/08/11 22:59:03 UTC
(steve) branch trunk updated: No need to involve shell here (#104)
This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git
The following commit(s) were added to refs/heads/trunk by this push:
new 5701d56 No need to involve shell here (#104)
5701d56 is described below
commit 5701d5649195235a42bf418373fc610c15fdbf38
Author: Sebb <se...@users.noreply.github.com>
AuthorDate: Tue Aug 11 23:58:58 2026 +0100
No need to involve shell here (#104)
---
whatif.rb | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/whatif.rb b/whatif.rb
index cff11a5..a1e4244 100755
--- a/whatif.rb
+++ b/whatif.rb
@@ -45,6 +45,7 @@
MEETINGS = File.expand_path('../Meetings') unless defined? MEETINGS
WHATIF = './whatif.py' unless defined? WHATIF
+require 'open3'
require 'wunderbar'
require 'tempfile'
@@ -63,9 +64,7 @@ def ini(vote)
end
def filtered_election(votes, seats, candidates)
- list = candidates.join(' ')
-
- output = `#{WHATIF} #{votes} #{seats} #{list}`
+ output, _stderr, _rc = Open3.capture3(WHATIF, votes, seats, *candidates)
output.scan(/.*elected$/).inject(Hash.new('none')) do |results, line|
name, status = line.scan(/^(.*?)\s+(n?o?t?\s?elected)$/).flatten
results.merge({name.gsub(/[^[[:alnum:]]]/,'') => status.gsub(/\s/, '-')})