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