showterm 0.2.1.pre.3 → 0.2.1.pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/showterm.rb +8 -6
- data/showterm.gemspec +1 -1
- metadata +1 -1
data/lib/showterm.rb
CHANGED
@@ -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 =
|
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
|
-
|
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
|
|
data/showterm.gemspec
CHANGED