showterm 0.2.1.pre.3 → 0.2.1.pre.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/showterm.rb +8 -6
  2. data/showterm.gemspec +1 -1
  3. metadata +1 -1
@@ -76,9 +76,9 @@ module Showterm
76
76
  #
77
77
  # @return [Boolean] whether the script command looks like it's working.
78
78
  def use_script?
79
- scriptfile, timingfile = record_with_script('echo', 'foo')
80
-
81
- scriptfile =~ /foo/ && timingfile =~ /^[0-9]/
79
+ scriptfile, timingfile = [temp_file, temp_file]
80
+ `#{script_command(scriptfile, timingfile, cmd)}`
81
+ scriptfile.open.read =~ /foo/ && timingfile.open.read =~ /^[0-9]/
82
82
  end
83
83
 
84
84
  # Record using the modern version of 'script'
@@ -87,16 +87,18 @@ module Showterm
87
87
  # @return [scriptfile, timingfile]
88
88
  def record_with_script(*cmd)
89
89
  scriptfile, timingfile = [temp_file, temp_file]
90
+ system script_command(scriptfile, timingfile, cmd)
91
+ [scriptfile.open.read, timingfile.open.read]
92
+ end
90
93
 
94
+ def script_command(scriptfile, timingfile, cmd)
91
95
  args = ['script']
92
96
  args << '-c' + cmd.join(" ") if cmd.size > 0
93
97
  args << '-q'
94
98
  args << '-t'
95
99
  args << scriptfile.path
96
100
 
97
- system("#{args.map{ |x| Shellwords.escape(x) }.join(" ")} 2>#{Shellwords.escape(timingfile.path)}")
98
-
99
- [scriptfile.open.read, timingfile.open.read]
101
+ "#{args.map{ |x| Shellwords.escape(x) }.join(" ")} 2>#{Shellwords.escape(timingfile.path)}"
100
102
  end
101
103
 
102
104
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "showterm"
3
- s.version = "0.2.1.pre.3"
3
+ s.version = "0.2.1.pre.4"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.author = "Conrad Irwin"
6
6
  s.email = "conrad.irwin@gmail.com"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre.3
4
+ version: 0.2.1.pre.4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: