Skip to content

Conversation

@Watson1978
Copy link
Contributor

Backport #5159

Which issue(s) this PR fixes:
Fixes #5148

What this PR does / why we need it:

Since Ruby 4.0, When we give pipe command in Kernel.open, it causes an error.

$ ruby -w -v -e "Kernel.open('| uname -a'){|out| p out.read }"
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
-e:1: warning: Calling Kernel#open with a leading '|' is deprecated and will be removed in Ruby 4.0; use IO.popen instead
"Linux UM890 6.17.1-0-MANJARO #1 SMP PREEMPT_DYNAMIC Tue, 07 Oct 2025 07:57:35 +0000 x86_64 GNU/Linux\n"

$ ruby -w -v -e "Kernel.open('| uname -a'){|out| p out.read }"
ruby 4.0.0dev (2025-11-20T00:03:23Z master 167c3dbaa0) +PRISM [x86_64-linux]
-e:1:in 'File#initialize': No such file or directory @ rb_sysopen - | uname -a (Errno::ENOENT)
	from -e:1:in 'Kernel.open'
	from -e:1:in '<main>'

This path will save the command's result in temporary files and use them instead due to avoid the error.

Docs Changes:
N/A

Release Note:
N/A

**Which issue(s) this PR fixes**:
Fixes #5148

**What this PR does / why we need it**:

Since Ruby 4.0, When we give pipe command in `Kernel.open`, it causes an
error.

```
$ ruby -w -v -e "Kernel.open('| uname -a'){|out| p out.read }"
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
-e:1: warning: Calling Kernel#open with a leading '|' is deprecated and will be removed in Ruby 4.0; use IO.popen instead
"Linux UM890 6.17.1-0-MANJARO #1 SMP PREEMPT_DYNAMIC Tue, 07 Oct 2025 07:57:35 +0000 x86_64 GNU/Linux\n"

$ ruby -w -v -e "Kernel.open('| uname -a'){|out| p out.read }"
ruby 4.0.0dev (2025-11-20T00:03:23Z master 167c3dbaa0) +PRISM [x86_64-linux]
-e:1:in 'File#initialize': No such file or directory @ rb_sysopen - | uname -a (Errno::ENOENT)
	from -e:1:in 'Kernel.open'
	from -e:1:in '<main>'
```

This path will save the command's result in temporary files and use them
instead due to avoid the error.

**Docs Changes**:
N/A

**Release Note**:
N/A

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978 Watson1978 added the CI Test/CI issues label Dec 9, 2025
@Watson1978 Watson1978 added this to the v1.16.11 milestone Dec 9, 2025
@daipom daipom merged commit 8140ef8 into v1.16 Dec 9, 2025
41 of 44 checks passed
@daipom daipom deleted the backport-to-1.16/pr5159 branch December 9, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Test/CI issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants