shells 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shells/shell_base.rb +16 -8
- data/lib/shells/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a2c0a0dc3fae93cfcca240627c9b95c27fd0c5
|
4
|
+
data.tar.gz: a50b317403339b3e08ec82a1da7eb2514797d509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: add66dd57d2f813499b65b4ecfa417a814cf6e56d3b565d9ebfe2a2d6838c78eefb4e71ab6a3eafc297860dbff6fd9fb166c37825f8dba771151c3a747b23aed
|
7
|
+
data.tar.gz: 7eaefcc0d6e2cd7c7671762f2971ae0b4d9bff6b8bec64891b0e7835355eb543017991ee43113d24065aa8d14cf3c1aebb87f8682b8761e3dd9d797f03fd631f
|
data/lib/shells/shell_base.rb
CHANGED
@@ -803,17 +803,13 @@ module Shells
|
|
803
803
|
combined_output
|
804
804
|
end
|
805
805
|
|
806
|
-
|
807
|
-
|
808
|
-
options[:prompt] + command,
|
809
|
-
options[:prompt] + ' ' + command
|
810
|
-
]
|
811
|
-
|
806
|
+
command_regex = command_match(command)
|
807
|
+
|
812
808
|
# Go until we run out of data or we find one of the possible command starts.
|
813
809
|
# Note that we EXPECT the command to the first line of the output from the command because we expect the
|
814
810
|
# shell to echo it back to us.
|
815
811
|
result_cmd,_,result_data = ret.partition("\n")
|
816
|
-
until result_data.to_s.strip == '' ||
|
812
|
+
until result_data.to_s.strip == '' || result_cmd.strip =~ command_regex
|
817
813
|
result_cmd,_,result_data = result_data.partition("\n")
|
818
814
|
end
|
819
815
|
|
@@ -842,7 +838,19 @@ module Shells
|
|
842
838
|
def stdcomb_hist
|
843
839
|
@stdcomb_hist ||= []
|
844
840
|
end
|
845
|
-
|
841
|
+
|
842
|
+
def command_match(command)
|
843
|
+
p = @options[:prompt]
|
844
|
+
.gsub('[', '\\[')
|
845
|
+
.gsub('(', '\\(')
|
846
|
+
.gsub('.', '\\.')
|
847
|
+
.gsub('*', '\\*')
|
848
|
+
.gsub('{', '\\{')
|
849
|
+
.gsub('?', '\\?')
|
850
|
+
|
851
|
+
/\A(?:#{p}\s*)?#{command}\z/
|
852
|
+
end
|
853
|
+
|
846
854
|
def prompt_match
|
847
855
|
# allow for trailing spaces or tabs, but no other whitespace.
|
848
856
|
@prompt_match ||= /#{@options[:prompt]}[ \t]*$/
|
data/lib/shells/version.rb
CHANGED