shellutils 0.0.9 → 0.0.10
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/shellutils.rb +10 -0
- data/lib/shellutils/version.rb +1 -1
- metadata +2 -3
data/lib/shellutils.rb
CHANGED
@@ -113,29 +113,39 @@ module ShellUtils
|
|
113
113
|
caller[index].scan(/`(.*)'/).flatten.to_s
|
114
114
|
end
|
115
115
|
|
116
|
+
DEBUG = true
|
116
117
|
def exec_cmd_and_clear_password(cmd)
|
117
118
|
puts cmd
|
119
|
+
puts "-2" if DEBUG
|
118
120
|
PTY.spawn(cmd) do |r, w|
|
121
|
+
puts "-3" if DEBUG
|
119
122
|
w.flush
|
120
123
|
w.sync = true
|
121
124
|
w.flush
|
125
|
+
puts "-4" if DEBUG
|
122
126
|
if r.expect(/[Pp]assword.*:.*$/)
|
127
|
+
puts "-5" if DEBUG
|
123
128
|
w.flush
|
124
129
|
w.puts(get_sudo_pwd)
|
125
130
|
w.flush
|
131
|
+
puts "-6" if DEBUG
|
126
132
|
begin
|
127
133
|
w.flush
|
134
|
+
puts "-7" if DEBUG
|
128
135
|
if r.expect(/[Pp]assword.*:.*$/)
|
129
136
|
error("the sudo password is incorrect. password=#{get_sudo_pwd}\nPlease change the password ex) set_sudo_pwd PASSWORD")
|
130
137
|
end
|
131
138
|
rescue
|
132
139
|
end
|
133
140
|
end
|
141
|
+
puts "-8" if DEBUG
|
134
142
|
w.flush
|
143
|
+
puts "-9" if DEBUG
|
135
144
|
begin
|
136
145
|
puts r.read
|
137
146
|
rescue Errno::EIO # GNU/Linux raises EIO.
|
138
147
|
end
|
148
|
+
puts "-10" if DEBUG
|
139
149
|
end
|
140
150
|
end
|
141
151
|
|
data/lib/shellutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shellutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -89,4 +89,3 @@ summary: Shell utils
|
|
89
89
|
test_files:
|
90
90
|
- spec/shellutils_spec.rb
|
91
91
|
- spec/spec_helper.rb
|
92
|
-
has_rdoc:
|