lib/tty/command/child_process.rb in tty-command-0.9.0 vs lib/tty/command/child_process.rb in tty-command-0.10.0
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require 'tempfile'
-require 'securerandom'
-require 'io/console'
+require "tempfile"
+require "securerandom"
+require "io/console"
module TTY
class Command
module ChildProcess
# Execute command in a child process with all IO streams piped
@@ -25,16 +25,16 @@
binmode = cmd.options[:binmode] || false
pty = cmd.options[:pty] || false
verbose = cmd.options[:verbose]
pty = try_loading_pty(verbose) if pty
- require('pty') if pty # load within this scope
+ require("pty") if pty # load within this scope
# Create pipes
- in_rd, in_wr = pty ? PTY.open : IO.pipe('utf-8') # reading
- out_rd, out_wr = pty ? PTY.open : IO.pipe('utf-8') # writing
- err_rd, err_wr = pty ? PTY.open : IO.pipe('utf-8') # error
+ in_rd, in_wr = pty ? PTY.open : IO.pipe("utf-8") # reading
+ out_rd, out_wr = pty ? PTY.open : IO.pipe("utf-8") # writing
+ err_rd, err_wr = pty ? PTY.open : IO.pipe("utf-8") # error
in_wr.sync = true
if binmode
in_wr.binmode
out_rd.binmode
@@ -130,11 +130,11 @@
# @api private
def convert(spawn_key, spawn_value)
key = fd_to_process_key(spawn_key)
value = spawn_value
- if key.to_s == 'in'
+ if key.to_s == "in"
value = convert_to_fd(spawn_value)
end
if fd?(spawn_value)
value = fd_to_process_key(spawn_value)
@@ -193,10 +193,10 @@
if object.is_a?(::String) && ::File.exist?(object)
return object
end
- tmp = ::Tempfile.new(::SecureRandom.uuid.split('-')[0])
+ tmp = ::Tempfile.new(::SecureRandom.uuid.split("-")[0])
content = try_reading(object)
tmp.write(content)
tmp.rewind
tmp
end