Skip to content

Commit daff032

Browse files
committed
Also check writable tty and raise if unavailable
1 parent 1048779 commit daff032

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

extconf.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
WARNING:
1111
WARNING: See https://github.com/rbenv/ruby-build/pull/2517 for more details.
1212
MSG
13-
if File.exist?("/dev/tty")
13+
14+
# extconf.rb runs in a captured subprocess, so the only way to output is via /dev/tty
15+
if File.exist?("/dev/tty") && File.writable?("/dev/tty")
1416
error << <<~MSG
1517
WARNING:
1618
WARNING: The native jruby executable has not been installed.
1719
MSG
1820
File.write("/dev/tty", error)
1921
else
22+
# /dev/tty is not available, so write to stderr and raise
2023
$stderr.write(error)
24+
raise
2125
end
2226
File.write("Makefile", dummy_makefile($srcdir).join(""))
2327
return

0 commit comments

Comments
 (0)