sys_cmd 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sys_cmd.rb +16 -1
- data/lib/sys_cmd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c02b5ad342cfe1834b58e1d12569592a8172c20
|
4
|
+
data.tar.gz: ce155ac1c8ce48cdc995dd4eb076de4fb7018d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9ab2af6ca3fabe134f1898f8a1898f92ece5dfd0172fcf5b1a44a548ccd75581b75b86866b4305c523c85bfc44369ddfbba5ecff9f093fbf952ac5dd51e86a5
|
7
|
+
data.tar.gz: f1b283a4bb2b80ae33d4abf3f222ac4586f59da1e6c5b176e8e94eb6f682d5bba92f508b97f8e7e1536f283b163265b35e41ac419439574f3df7a33def02d8fe
|
data/lib/sys_cmd.rb
CHANGED
@@ -78,6 +78,9 @@ module SysCmd
|
|
78
78
|
else
|
79
79
|
option = option.dup
|
80
80
|
end
|
81
|
+
if @shell.requires_escaping?(option)
|
82
|
+
option = @shell.escape_value(option)
|
83
|
+
end
|
81
84
|
option << ' ' << @shell.escape_value(value) if value
|
82
85
|
option << @shell.escape_value(options[:join_value]) if options[:join_value]
|
83
86
|
option << '=' << @shell.escape_value(options[:equal_value]) if options[:equal_value]
|
@@ -181,7 +184,11 @@ module SysCmd
|
|
181
184
|
# are note interpreted by a shell in that case.
|
182
185
|
def argument(value, options = {})
|
183
186
|
return unless @shell.applicable?(options)
|
184
|
-
|
187
|
+
value = value.to_s
|
188
|
+
if @shell.requires_escaping?(value)
|
189
|
+
value = @shell.escape_value(value)
|
190
|
+
end
|
191
|
+
@command << ' ' << value
|
185
192
|
@last_arg = :argument
|
186
193
|
end
|
187
194
|
|
@@ -372,6 +379,10 @@ module SysCmd
|
|
372
379
|
end
|
373
380
|
end
|
374
381
|
|
382
|
+
def self.requires_escaping?(text, options = {})
|
383
|
+
/[\s\"\']/ =~ text
|
384
|
+
end
|
385
|
+
|
375
386
|
def self.split(text, options = {})
|
376
387
|
case os_type(options)
|
377
388
|
when :windows
|
@@ -433,6 +444,10 @@ module SysCmd
|
|
433
444
|
SysCmd.escape(text, os: @type)
|
434
445
|
end
|
435
446
|
|
447
|
+
def requires_escaping?(text)
|
448
|
+
SysCmd.requires_escaping?(text, os: @type)
|
449
|
+
end
|
450
|
+
|
436
451
|
def split(text)
|
437
452
|
SysCmd.split(text, os: @type)
|
438
453
|
end
|
data/lib/sys_cmd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys_cmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Goizueta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|