Skip to content

Commit

Permalink
Change to fix loading pty module to be within scope
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Nov 18, 2017
1 parent 2782fbc commit 2372a35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/tty/command/child_process.rb
Expand Up @@ -26,6 +26,7 @@ def spawn(cmd)
pty = cmd.options[:pty] || false

pty = try_loading_pty if pty
require('pty') if pty # load within this scope

# Create pipes
in_rd, in_wr = pty ? PTY.open : IO.pipe('utf-8') # reading
Expand Down Expand Up @@ -83,7 +84,7 @@ def spawn(cmd)
def try_loading_pty
require 'pty'
true
rescue
rescue LoadError
warn("Requested PTY device but the system doesn't support it.")
false
end
Expand Down

0 comments on commit 2372a35

Please sign in to comment.