Update to childprocess 4.1.0.

Resolves: rhbz#1733782
epel9
Pavel Valena 4 years ago
parent 955b9fed52
commit a86986ee9a

6
.gitignore vendored

@ -1,5 +1 @@
/childprocess-0.3.6.gem /childprocess-*.gem
/childprocess-0.3.9.gem
/childprocess-0.5.3.gem
/childprocess-0.5.9.gem
/childprocess-1.0.1.gem

@ -1,49 +0,0 @@
From 21973e113d4e2f6ad603184609f253af27fd1521 Mon Sep 17 00:00:00 2001
From: Hans de Graaff <hans@degraaff.org>
Date: Mon, 29 Apr 2019 18:41:35 +0200
Subject: [PATCH] Rewrite unix fork reopen to be compatible with ruby 2.6
On ruby 2.6 the original code would fail specs:
lib/childprocess/unix/fork_exec_process.rb:32:in `reopen': exclusive
access mode is not supported (ArgumentError)
The documentation for reopen shows that it has two ways to call it:
reopen(other_IO) -> ios
reopen(path, mode [,opt]) -> ios
With ruby 2.4 and 2.5 calling reopen with a path and no mode seems to
work fine, but with ruby 2.6 this triggers the spec failure.
This commit splits the calls based on stdout/stderr availability so
that both types of reopen calls can get the required parameters. This
fixes the 2.6 specs while being backward compatible with ruby 2.4 and
2.5.
---
lib/childprocess/unix/fork_exec_process.rb | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/childprocess/unix/fork_exec_process.rb b/lib/childprocess/unix/fork_exec_process.rb
index 5ed2a79..cc7a850 100644
--- a/lib/childprocess/unix/fork_exec_process.rb
+++ b/lib/childprocess/unix/fork_exec_process.rb
@@ -29,8 +29,16 @@ def launch_process
exec_r.close
set_env
- STDOUT.reopen(stdout || "/dev/null")
- STDERR.reopen(stderr || "/dev/null")
+ if stdout
+ STDOUT.reopen(stdout)
+ else
+ STDOUT.reopen("/dev/null", "a+")
+ end
+ if stderr
+ STDERR.reopen(stderr)
+ else
+ STDERR.reopen("/dev/null", "a+")
+ end
if duplex?
STDIN.reopen(reader)

@ -1,15 +1,12 @@
%global gem_name childprocess %global gem_name childprocess
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 1.0.1 Version: 4.1.0
Release: 8%{?dist} Release: 1%{?dist}
Summary: A gem for controlling external programs running in the background Summary: A gem for controlling external programs running in the background
License: MIT License: MIT
URL: http://github.com/enkessler/childprocess URL: http://github.com/enkessler/childprocess
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fix Ruby 2.6 compatibility.
# https://github.com/enkessler/childprocess/pull/149
Patch0: rubygem-childprocess-1.0.1-Rewrite-unix-fork-reopen-to-be-compatible-with-ruby-2.6.patch
BuildRequires: ruby(release) BuildRequires: ruby(release)
BuildRequires: rubygems-devel BuildRequires: rubygems-devel
BuildRequires: rubygem(ffi) BuildRequires: rubygem(ffi)
@ -34,19 +31,8 @@ Documentation for %{name}.
%prep %prep
%setup -q -n %{gem_name}-%{version} %setup -q -n %{gem_name}-%{version}
%patch0 -p1
# Disable windows specific installation of FFI gem.
sed -i "/extensions/ s/^/#/" ../%{gem_name}-%{version}.gemspec
%gemspec_remove_dep -g rake '< 13.0'
%gemspec_remove_file "ext/mkrf_conf.rb"
%build %build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install %gem_install
%install %install
@ -67,6 +53,11 @@ sed -i "/gemspec.validate/ s/^/#/" spec/childprocess_spec.rb
# in the environment" test case. # in the environment" test case.
LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec
# Disable test failing for posix-spawn
# https://github.com/enkessler/childprocess/issues/173
sed -i '/^\s*it "can write to stdin interactively if duplex = true" do$/ a \
skip' spec/io_spec.rb
# Test also posix_spawn, which requires FFI. # Test also posix_spawn, which requires FFI.
CHILDPROCESS_POSIX_SPAWN=true LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec CHILDPROCESS_POSIX_SPAWN=true LC_ALL=C.UTF-8 RUBYOPT=-Ilib rspec spec
popd popd
@ -91,6 +82,10 @@ popd
%{gem_instdir}/spec %{gem_instdir}/spec
%changelog %changelog
* Fri Sep 17 2021 Pavel Valena <pvalena@redhat.com> - 4.1.0-1
- Update to childprocess 4.1.0.
Resolves: rhbz#1733782
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-8 * Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

@ -1 +1 @@
SHA512 (childprocess-1.0.1.gem) = efe61096dd09f6278582763692104fcc3beacfc96065372afdee355b68ef6ed498baf855f911d2a0b3a186d978d6d737519ae189064293af2d756a7356dad30d SHA512 (childprocess-4.1.0.gem) = e635c3acfa5ad85891c3879f240c7e96d47d7d5ec3f472f4ce6661552b0fb7bd72c5e3b9fb73f4f9312b749fbe554b4be388e56a31a3c63c39743d055d774def

Loading…
Cancel
Save