Module: Lich::Common::WindowsCommandLine
- Defined in:
- documented/common/windows_command_line.rb
Overview
Splits executable command templates using Windows CRT quoting rules. This is not a cmd.exe interpreter: shell operators require an explicit wrapper command. Configured additional arguments never pass through it.
Class Method Summary collapse
-
.split(command) ⇒ Array<String>
Executable followed by literal arguments.
Class Method Details
.split(command) ⇒ Array<String>
Returns executable followed by literal arguments.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'documented/common/windows_command_line.rb', line 16 def self.split(command) raise ArgumentError, 'Control characters are not allowed in frontend commands.' if command.to_s.match?(/[\r\n\x00]/) scanner = StringScanner.new(command.to_s) arguments = [] until scanner.eos? scanner.skip(/[ \t]+/) break if scanner.eos? arguments << read_argument(scanner, executable: arguments.empty?) end raise ArgumentError, 'A frontend command must name an executable.' if arguments.empty? || arguments.first.empty? arguments end |