tty-command 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +44 -44
  5. data/lib/tty-command.rb +1 -1
  6. data/lib/tty/command.rb +18 -18
  7. data/lib/tty/command/child_process.rb +9 -9
  8. data/lib/tty/command/cmd.rb +11 -11
  9. data/lib/tty/command/dry_runner.rb +3 -3
  10. data/lib/tty/command/exit_error.rb +1 -1
  11. data/lib/tty/command/printers/abstract.rb +8 -10
  12. data/lib/tty/command/printers/null.rb +1 -4
  13. data/lib/tty/command/printers/pretty.rb +10 -15
  14. data/lib/tty/command/printers/progress.rb +3 -8
  15. data/lib/tty/command/printers/quiet.rb +3 -7
  16. data/lib/tty/command/process_runner.rb +25 -17
  17. data/lib/tty/command/truncator.rb +3 -3
  18. data/lib/tty/command/version.rb +1 -1
  19. metadata +20 -68
  20. data/Rakefile +0 -10
  21. data/bin/console +0 -6
  22. data/bin/setup +0 -6
  23. data/examples/bash.rb +0 -12
  24. data/examples/basic.rb +0 -9
  25. data/examples/buffer.rb +0 -4
  26. data/examples/env.rb +0 -9
  27. data/examples/logger.rb +0 -10
  28. data/examples/output.rb +0 -10
  29. data/examples/pty.rb +0 -9
  30. data/examples/redirect_stderr.rb +0 -10
  31. data/examples/redirect_stdin.rb +0 -15
  32. data/examples/redirect_stdout.rb +0 -10
  33. data/examples/stdin_input.rb +0 -10
  34. data/examples/threaded.rb +0 -14
  35. data/examples/timeout.rb +0 -11
  36. data/examples/timeout_input.rb +0 -12
  37. data/examples/wait.rb +0 -21
  38. data/spec/spec_helper.rb +0 -78
  39. data/spec/unit/binmode_spec.rb +0 -29
  40. data/spec/unit/cmd_spec.rb +0 -152
  41. data/spec/unit/dry_run_spec.rb +0 -42
  42. data/spec/unit/exit_error_spec.rb +0 -25
  43. data/spec/unit/input_spec.rb +0 -13
  44. data/spec/unit/output_spec.rb +0 -25
  45. data/spec/unit/printer_spec.rb +0 -50
  46. data/spec/unit/printers/custom_spec.rb +0 -48
  47. data/spec/unit/printers/null_spec.rb +0 -36
  48. data/spec/unit/printers/pretty_spec.rb +0 -172
  49. data/spec/unit/printers/progress_spec.rb +0 -45
  50. data/spec/unit/printers/quiet_spec.rb +0 -71
  51. data/spec/unit/pty_spec.rb +0 -62
  52. data/spec/unit/redirect_spec.rb +0 -103
  53. data/spec/unit/result_spec.rb +0 -64
  54. data/spec/unit/ruby_spec.rb +0 -20
  55. data/spec/unit/run_spec.rb +0 -159
  56. data/spec/unit/test_spec.rb +0 -11
  57. data/spec/unit/timeout_spec.rb +0 -36
  58. data/spec/unit/truncator_spec.rb +0 -73
  59. data/tasks/console.rake +0 -11
  60. data/tasks/coverage.rake +0 -11
  61. data/tasks/spec.rake +0 -29
  62. data/tty-command.gemspec +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb68a910c5ff66e9272e4a13e3f2d0efd90752bcb9c4da5d6e95c338806f6041
4
- data.tar.gz: 4d93dcafc447d2f1fb16678901b503b0a6fe73a786eb0d671743c128f687e2b4
3
+ metadata.gz: efe5adcd3fe993ed0b35a1d640b77e50d42611e4c87efd296656c82680bbe19e
4
+ data.tar.gz: 91276213aee2b1a56b3b983e3779d47da9c2de4b2f16fd9fa1603173d12ec522
5
5
  SHA512:
6
- metadata.gz: '019fa8d2991d8fc81ab35b563e9538e1d992da8acbe33948d0ca45116b844f1001893f31a7613d1815bfcedb5899fbb0e4e0ae9a8030955fca67ff200056bd8f'
7
- data.tar.gz: 3ddc25cfab6b31e2d1f18367eb92b2751068e3b1d3187c86a4169cd7e7429d7ef75d0aeaa2ff98d98eb2a95f16651bcd6417196452a2303268c254950bb898bd
6
+ metadata.gz: 3d3159b1a53f1649a220c6cd41f00fe8c9621c26460715d2352c1ff010c84de2f8ced1a06ce4de998da16f43a9d254429b37f825a370059dad1828b820c28060
7
+ data.tar.gz: '094d9b3afbc63cb7b94888873e602badf0dc2dd6dee3c2a13c79d2865ee7c1270f52136df5472c9c080f1f157778808033ffe3a4989b72cba6dbcf5d83d57c3c'
@@ -1,5 +1,17 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.10.0] - 2020-10-22
4
+
5
+ ### Changed
6
+ * Change :chdir option to escape directory location path
7
+ * Change gemspec to add metadata and remove test artefacts
8
+ * Change to update pastel dependency and restrict version to minor only
9
+ * Remove bundler as a dev dependency and relax rspec's upper boundary
10
+
11
+ ### Fixed
12
+ * Fix Ruby 2.7 keyword conversion errors
13
+ * Fix error when environment variable contains % character
14
+
3
15
  ## [v0.9.0] - 2019-09-28
4
16
 
5
17
  ### Changed
@@ -128,6 +140,7 @@
128
140
 
129
141
  * Initial implementation and release
130
142
 
143
+ [v0.10.0]: https://github.com/piotrmurach/tty-command/compare/v0.9.0...v0.10.0
131
144
  [v0.9.0]: https://github.com/piotrmurach/tty-command/compare/v0.8.2...v0.9.0
132
145
  [v0.8.2]: https://github.com/piotrmurach/tty-command/compare/v0.8.1...v0.8.2
133
146
  [v0.8.1]: https://github.com/piotrmurach/tty-command/compare/v0.8.0...v0.8.1
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Piotr Murach
3
+ Copyright (c) 2016 Piotr Murach (https://piotrmurach.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <a href="https://piotrmurach.github.io/tty" target="_blank"><img width="130" src="https://cdn.rawgit.com/piotrmurach/tty/master/images/tty.png" alt="tty logo" /></a>
2
+ <a href="https://ttytoolkit.org"><img width="130" src="https://github.com/piotrmurach/tty/blob/master/images/tty.png" alt="TTY Toolkit logo"/></a>
3
3
  </div>
4
4
 
5
5
  # TTY::Command [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
@@ -36,7 +36,7 @@ Why should we be handcuffed to `sh` or `bash` for these scripts when we could be
36
36
  Add this line to your application's Gemfile:
37
37
 
38
38
  ```ruby
39
- gem 'tty-command'
39
+ gem "tty-command"
40
40
  ```
41
41
 
42
42
  And then execute:
@@ -88,11 +88,11 @@ Or install it yourself as:
88
88
  Create a command instance and then run some commands:
89
89
 
90
90
  ```ruby
91
- require 'tty-command'
91
+ require "tty-command"
92
92
 
93
93
  cmd = TTY::Command.new
94
- cmd.run('ls -la')
95
- cmd.run('echo Hello!')
94
+ cmd.run("ls -la")
95
+ cmd.run("echo Hello!")
96
96
  ```
97
97
 
98
98
  Note that `run` will throw an exception if the command fails. This is already an improvement over ordinary shell scripts, which just keep on going when things go bad. That usually makes things worse.
@@ -100,7 +100,7 @@ Note that `run` will throw an exception if the command fails. This is already an
100
100
  You can use the return value to capture stdout and stderr:
101
101
 
102
102
  ```ruby
103
- out, err = cmd.run('cat ~/.bashrc | grep alias')
103
+ out, err = cmd.run("cat ~/.bashrc | grep alias")
104
104
  ```
105
105
 
106
106
  Instead of using a plain old string, you can break up the arguments and they'll get escaped if necessary:
@@ -127,13 +127,13 @@ The `env`, `command` and `options` arguments are described in the following sect
127
127
  For example, to display file contents:
128
128
 
129
129
  ```ruby
130
- cmd.run('cat file.txt')
130
+ cmd.run("cat file.txt")
131
131
  ```
132
132
 
133
133
  If the command succeeds, a `TTY::Command::Result` is returned that records stdout and stderr:
134
134
 
135
135
  ```ruby
136
- out, err = cmd.run('date')
136
+ out, err = cmd.run("date")
137
137
  puts "The date is #{out}"
138
138
  # => "The date is Tue 10 May 2016 22:30:15 BST\n"
139
139
  ```
@@ -141,7 +141,7 @@ puts "The date is #{out}"
141
141
  You can also pass a block that gets invoked anytime stdout and/or stderr receive output:
142
142
 
143
143
  ```ruby
144
- cmd.run('long running script') do |out, err|
144
+ cmd.run("long running script") do |out, err|
145
145
  output << out if out
146
146
  errors << err if err
147
147
  end
@@ -161,8 +161,8 @@ If the error output is very long, the stderr may contain only a prefix, number o
161
161
  If you expect a command to fail occasionally, use `run!` instead. Then you can detect failures and respond appropriately. For example:
162
162
 
163
163
  ```ruby
164
- if cmd.run!('which xyzzy').failure?
165
- cmd.run('brew install xyzzy')
164
+ if cmd.run!("which xyzzy").failure?
165
+ cmd.run("brew install xyzzy")
166
166
  end
167
167
  ```
168
168
 
@@ -184,7 +184,7 @@ cmd = TTY::Command.new(printer: :progress)
184
184
  By default the printers log to `stdout` but this can be changed by passing an object that responds to `<<` message:
185
185
 
186
186
  ```ruby
187
- logger = Logger.new('dev.log')
187
+ logger = Logger.new("dev.log")
188
188
  cmd = TTY::Command.new(output: logger)
189
189
  ```
190
190
 
@@ -206,7 +206,7 @@ By default, when logging is enabled and `pretty` printer is used, each log entry
206
206
 
207
207
  ```ruby
208
208
  cmd = TTY::Command.new(uuid: false)
209
- cmd.run('rm -R all_my_files')
209
+ cmd.run("rm -R all_my_files")
210
210
  # =>
211
211
  # Running rm -r all_my_files
212
212
  # ...
@@ -230,13 +230,13 @@ When using a command that can fail, setting `:only_output_on_error` option to `t
230
230
 
231
231
  ```ruby
232
232
  cmd = TTY::Command.new
233
- cmd.run('non_failing_command', only_output_on_error: true)
233
+ cmd.run("non_failing_command", only_output_on_error: true)
234
234
  ```
235
235
 
236
236
  This will only print the `Running` and `Finished` lines, while:
237
237
 
238
238
  ```ruby
239
- cmd.run('non_failing_command')
239
+ cmd.run("non_failing_command")
240
240
  ```
241
241
 
242
242
  will also print any output that the `non_failing_command` might generate.
@@ -244,13 +244,13 @@ will also print any output that the `non_failing_command` might generate.
244
244
  Running either:
245
245
 
246
246
  ```ruby
247
- cmd.run('failing_command', only_output_on_error: true)
247
+ cmd.run("failing_command", only_output_on_error: true)
248
248
  ```
249
249
 
250
250
  either:
251
251
 
252
252
  ```ruby
253
- cmd.run('failing_command')
253
+ cmd.run("failing_command")
254
254
  ```
255
255
 
256
256
  will also print the output.
@@ -271,7 +271,7 @@ Sometimes it can be useful to put your script into a "dry run" mode that prints
271
271
 
272
272
  ```ruby
273
273
  cmd = TTY::Command.new(dry_run: true)
274
- cmd.run(:rm, 'all_my_files')
274
+ cmd.run(:rm, "all_my_files")
275
275
  # => [123abc] (dry run) rm all_my_files
276
276
  ```
277
277
 
@@ -286,7 +286,7 @@ cmd.dry_run? # => true
286
286
  If you need to wait for a long running script and stop it when a given pattern has been matched use `wait` like so:
287
287
 
288
288
  ```ruby
289
- cmd.wait 'tail -f /var/log/production.log', /something happened/
289
+ cmd.wait "tail -f /var/log/production.log", /something happened/
290
290
  ```
291
291
 
292
292
  ### 2.6 Test
@@ -294,7 +294,7 @@ cmd.wait 'tail -f /var/log/production.log', /something happened/
294
294
  To simulate classic bash test command you case use `test` method with expression to check as a first argument:
295
295
 
296
296
  ```ruby
297
- if cmd.test '-e /etc/passwd'
297
+ if cmd.test "-e /etc/passwd"
298
298
  puts "Sweet..."
299
299
  else
300
300
  puts "Ohh no! Where is it?"
@@ -317,19 +317,19 @@ cmd.ruby %q{-e "puts 'Hello world'"}
317
317
  The environment variables need to be provided as hash entries, that can be set directly as a first argument:
318
318
 
319
319
  ```ruby
320
- cmd.run({'RAILS_ENV' => 'PRODUCTION'}, :rails, 'server')
320
+ cmd.run({"RAILS_ENV" => "PRODUCTION"}, :rails, "server")
321
321
  ```
322
322
 
323
323
  or as an option with `:env` key:
324
324
 
325
325
  ```ruby
326
- cmd.run(:rails, 'server', env: {rails_env: :production})
326
+ cmd.run(:rails, "server", env: {rails_env: :production})
327
327
  ```
328
328
 
329
329
  When a value in env is nil, the variable is unset in the child process:
330
330
 
331
331
  ```ruby
332
- cmd.run(:echo, 'hello', env: {foo: 'bar', baz: nil})
332
+ cmd.run(:echo, "hello", env: {foo: "bar", baz: nil})
333
333
  ```
334
334
 
335
335
  ### 3.2 Options
@@ -367,27 +367,27 @@ The hash key and value specify a file descriptor in the child process (stderr &
367
367
  You can also redirect to a file:
368
368
 
369
369
  ```ruby
370
- cmd.run(:cat, :in => 'file')
371
- cmd.run(:cat, :in => open('/etc/passwd'))
372
- cmd.run(:ls, :out => 'log')
370
+ cmd.run(:cat, :in => "file")
371
+ cmd.run(:cat, :in => open("/etc/passwd"))
372
+ cmd.run(:ls, :out => "log")
373
373
  cmd.run(:ls, :out => "/dev/null")
374
- cmd.run(:ls, :out => 'out.log', :err => "err.log")
374
+ cmd.run(:ls, :out => "out.log", :err => "err.log")
375
375
  cmd.run(:ls, [:out, :err] => "log")
376
- cmd.run("ls 1>&2", :err => 'log')
376
+ cmd.run("ls 1>&2", :err => "log")
377
377
  ```
378
378
 
379
379
  It is possible to specify flags and permissions of file creation explicitly by passing an array value:
380
380
 
381
381
  ```ruby
382
- cmd.run(:ls, :out => ['log', 'w']) # 0664 assumed
383
- cmd.run(:ls, :out => ['log', 'w', 0600])
384
- cmd.run(:ls, :out => ['log', File::WRONLY|File::EXCL|File::CREAT, 0600])
382
+ cmd.run(:ls, :out => ["log", "w"]) # 0664 assumed
383
+ cmd.run(:ls, :out => ["log", "w", 0600])
384
+ cmd.run(:ls, :out => ["log", File::WRONLY|File::EXCL|File::CREAT, 0600])
385
385
  ```
386
386
 
387
387
  You can, for example, read data from one source and output to another:
388
388
 
389
389
  ```ruby
390
- cmd.run("cat", :in => "Gemfile", :out => 'gemfile.log')
390
+ cmd.run("cat", :in => "Gemfile", :out => "gemfile.log")
391
391
  ```
392
392
 
393
393
  #### 3.2.2 Handling Input
@@ -402,7 +402,7 @@ puts "Your name: #{name}"
402
402
  In order to execute `cli` with name input do:
403
403
 
404
404
  ```ruby
405
- cmd.run('cli', input: "Piotr\n")
405
+ cmd.run("cli", input: "Piotr\n")
406
406
  # => Your name: Piotr
407
407
  ```
408
408
 
@@ -496,7 +496,7 @@ In addition, when pty device is used, any input to command may be echoed to the
496
496
  To change directory in which the command is run pass the `:chdir` option:
497
497
 
498
498
  ```ruby
499
- cmd.run(:echo, 'hello', chdir: '/var/tmp')
499
+ cmd.run(:echo, "hello", chdir: "/var/tmp")
500
500
  ```
501
501
 
502
502
  #### 3.2.8 User
@@ -504,7 +504,7 @@ cmd.run(:echo, 'hello', chdir: '/var/tmp')
504
504
  To run command as a given user do:
505
505
 
506
506
  ```ruby
507
- cmd.run(:echo, 'hello', user: 'piotr')
507
+ cmd.run(:echo, "hello", user: "piotr")
508
508
  ```
509
509
 
510
510
  #### 3.2.9 Group
@@ -512,7 +512,7 @@ cmd.run(:echo, 'hello', user: 'piotr')
512
512
  To run command as part of group do:
513
513
 
514
514
  ```ruby
515
- cmd.run(:echo, 'hello', group: 'devs')
515
+ cmd.run(:echo, "hello", group: "devs")
516
516
  ```
517
517
 
518
518
  #### 3.2.10 Umask
@@ -520,7 +520,7 @@ cmd.run(:echo, 'hello', group: 'devs')
520
520
  To run command with umask do:
521
521
 
522
522
  ```ruby
523
- cmd.run(:echo, 'hello', umask: '007')
523
+ cmd.run(:echo, "hello", umask: "007")
524
524
  ```
525
525
 
526
526
  ### 3.3 Result
@@ -528,13 +528,13 @@ cmd.run(:echo, 'hello', umask: '007')
528
528
  Each time you run command the stdout and stderr are captured and return as result. The result can be examined directly by casting it to tuple:
529
529
 
530
530
  ```ruby
531
- out, err = cmd.run(:echo, 'Hello')
531
+ out, err = cmd.run(:echo, "Hello")
532
532
  ```
533
533
 
534
534
  However, if you want to you can defer reading:
535
535
 
536
536
  ```ruby
537
- result = cmd.run(:echo, 'Hello')
537
+ result = cmd.run(:echo, "Hello")
538
538
  result.out
539
539
  result.err
540
540
  ```
@@ -544,7 +544,7 @@ result.err
544
544
  To check if command exited successfully use `success?`:
545
545
 
546
546
  ```ruby
547
- result = cmd.run(:echo, 'Hello')
547
+ result = cmd.run(:echo, "Hello")
548
548
  result.success? # => true
549
549
  ```
550
550
 
@@ -553,7 +553,7 @@ result.success? # => true
553
553
  To check if command exited unsuccessfully use `failure?` or `failed?`:
554
554
 
555
555
  ```ruby
556
- result = cmd.run(:echo, 'Hello')
556
+ result = cmd.run(:echo, "Hello")
557
557
  result.failure? # => false
558
558
  result.failed? # => false
559
559
  ```
@@ -563,7 +563,7 @@ result.failed? # => false
563
563
  To check if command ran to completion use `exited?` or `complete?`:
564
564
 
565
565
  ```ruby
566
- result = cmd.run(:echo, 'Hello')
566
+ result = cmd.run(:echo, "Hello")
567
567
  result.exited? # => true
568
568
  result.complete? # => true
569
569
  ```
@@ -573,7 +573,7 @@ result.complete? # => true
573
573
  The result itself is an enumerable and allows you to iterate over the stdout output:
574
574
 
575
575
  ```ruby
576
- result = cmd.run(:ls, '-1')
576
+ result = cmd.run(:ls, "-1")
577
577
  result.each { |line| puts line }
578
578
  # =>
579
579
  # CHANGELOG.md
@@ -596,7 +596,7 @@ TTY::Command.record_separator = "\n\r"
596
596
  or configured per `each` call by passing delimiter as an argument:
597
597
 
598
598
  ```ruby
599
- cmd.run(:ls, '-1').each("\t") { ... }
599
+ cmd.run(:ls, "-1").each("\t") { ... }
600
600
  ```
601
601
 
602
602
  ### 3.4 Custom printer
@@ -1 +1 @@
1
- require 'tty/command'
1
+ require_relative "tty/command"
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rbconfig'
4
-
5
- require_relative 'command/cmd'
6
- require_relative 'command/exit_error'
7
- require_relative 'command/dry_runner'
8
- require_relative 'command/process_runner'
9
- require_relative 'command/printers/null'
10
- require_relative 'command/printers/pretty'
11
- require_relative 'command/printers/progress'
12
- require_relative 'command/printers/quiet'
13
- require_relative 'command/version'
3
+ require "rbconfig"
4
+
5
+ require_relative "command/cmd"
6
+ require_relative "command/exit_error"
7
+ require_relative "command/dry_runner"
8
+ require_relative "command/process_runner"
9
+ require_relative "command/printers/null"
10
+ require_relative "command/printers/pretty"
11
+ require_relative "command/printers/progress"
12
+ require_relative "command/printers/quiet"
13
+ require_relative "command/version"
14
14
 
15
15
  module TTY
16
16
  class Command
@@ -19,9 +19,9 @@ module TTY
19
19
  TimeoutExceeded = Class.new(StandardError)
20
20
 
21
21
  # Path to the current Ruby
22
- RUBY = ENV['RUBY'] || ::File.join(
23
- RbConfig::CONFIG['bindir'],
24
- RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
22
+ RUBY = ENV["RUBY"] || ::File.join(
23
+ RbConfig::CONFIG["bindir"],
24
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
25
25
  )
26
26
 
27
27
  WIN_PLATFORMS = /cygwin|mswin|mingw|bccwin|wince|emx/.freeze
@@ -35,7 +35,7 @@ module TTY
35
35
  end
36
36
 
37
37
  def self.windows?
38
- !!(RbConfig::CONFIG['host_os'] =~ WIN_PLATFORMS)
38
+ !!(RbConfig::CONFIG["host_os"] =~ WIN_PLATFORMS)
39
39
  end
40
40
 
41
41
  attr_reader :printer
@@ -128,7 +128,7 @@ module TTY
128
128
  def wait(*args)
129
129
  pattern = args.pop
130
130
  unless pattern
131
- raise ArgumentError, 'Please provide condition to wait for'
131
+ raise ArgumentError, "Please provide condition to wait for"
132
132
  end
133
133
 
134
134
  run(*args) do |out, _|
@@ -174,7 +174,7 @@ module TTY
174
174
  # @api private
175
175
  def command(*args)
176
176
  cmd = Cmd.new(*args)
177
- cmd.update(@cmd_options)
177
+ cmd.update(**@cmd_options)
178
178
  cmd
179
179
  end
180
180
 
@@ -204,7 +204,7 @@ module TTY
204
204
  #
205
205
  # @api private
206
206
  def find_printer_class(name)
207
- const_name = name.to_s.split('_').map(&:capitalize).join.to_sym
207
+ const_name = name.to_s.split("_").map(&:capitalize).join.to_sym
208
208
  if const_name.empty? || !TTY::Command::Printers.const_defined?(const_name)
209
209
  raise ArgumentError, %(Unknown printer type "#{name}")
210
210
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
4
- require 'securerandom'
5
- require 'io/console'
3
+ require "tempfile"
4
+ require "securerandom"
5
+ require "io/console"
6
6
 
7
7
  module TTY
8
8
  class Command
@@ -27,12 +27,12 @@ module TTY
27
27
  verbose = cmd.options[:verbose]
28
28
 
29
29
  pty = try_loading_pty(verbose) if pty
30
- require('pty') if pty # load within this scope
30
+ require("pty") if pty # load within this scope
31
31
 
32
32
  # Create pipes
33
- in_rd, in_wr = pty ? PTY.open : IO.pipe('utf-8') # reading
34
- out_rd, out_wr = pty ? PTY.open : IO.pipe('utf-8') # writing
35
- err_rd, err_wr = pty ? PTY.open : IO.pipe('utf-8') # error
33
+ in_rd, in_wr = pty ? PTY.open : IO.pipe("utf-8") # reading
34
+ out_rd, out_wr = pty ? PTY.open : IO.pipe("utf-8") # writing
35
+ err_rd, err_wr = pty ? PTY.open : IO.pipe("utf-8") # error
36
36
  in_wr.sync = true
37
37
 
38
38
  if binmode
@@ -132,7 +132,7 @@ module TTY
132
132
  key = fd_to_process_key(spawn_key)
133
133
  value = spawn_value
134
134
 
135
- if key.to_s == 'in'
135
+ if key.to_s == "in"
136
136
  value = convert_to_fd(spawn_value)
137
137
  end
138
138
 
@@ -195,7 +195,7 @@ module TTY
195
195
  return object
196
196
  end
197
197
 
198
- tmp = ::Tempfile.new(::SecureRandom.uuid.split('-')[0])
198
+ tmp = ::Tempfile.new(::SecureRandom.uuid.split("-")[0])
199
199
  content = try_reading(object)
200
200
  tmp.write(content)
201
201
  tmp.rewind