shells 0.1.14 → 0.1.15

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deb503621ed53873d55b579bbe6f2c9ef8e031ce
4
- data.tar.gz: 0da90d54124b3e02c55c2ac3df69f6b8db09d871
3
+ metadata.gz: c2a2c0a0dc3fae93cfcca240627c9b95c27fd0c5
4
+ data.tar.gz: a50b317403339b3e08ec82a1da7eb2514797d509
5
5
  SHA512:
6
- metadata.gz: ea7e947ee7797532aeb53dcde2ba5b92fd84580f7178820a0cefbf7253a973ac0bfa7246116906196769312b28f3752ea4fcd391a51c956a3f798208de594811
7
- data.tar.gz: cc983d7364478548eeee1d081526b5c734a431ab19511345dc5f02b558a711e36c101ef4c8876b3f0aed4a54ca2a3b496e28226423a3497929bffbfab2e93e7c
6
+ metadata.gz: add66dd57d2f813499b65b4ecfa417a814cf6e56d3b565d9ebfe2a2d6838c78eefb4e71ab6a3eafc297860dbff6fd9fb166c37825f8dba771151c3a747b23aed
7
+ data.tar.gz: 7eaefcc0d6e2cd7c7671762f2971ae0b4d9bff6b8bec64891b0e7835355eb543017991ee43113d24065aa8d14cf3c1aebb87f8682b8761e3dd9d797f03fd631f
@@ -803,17 +803,13 @@ module Shells
803
803
  combined_output
804
804
  end
805
805
 
806
- possible_starts = [
807
- command,
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 == '' || possible_starts.include?(result_cmd)
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]*$/
@@ -1,3 +1,3 @@
1
1
  module Shells
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.15"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beau Barker