Method: Shellwords.dos_escape
- Defined in:
- lib/standard/facets/shellwords.rb
.dos_escape(cmdline) ⇒ Object
Escape special character used in DOS-based shells.
TODO: How to integrate with rest of system?
-
Use platform condition?
-
Use separate dos_xxx methods?
-
Put in separate PowerShellwords module?
CREDIT: Lavir the Whiolet
30 31 32 |
# File 'lib/standard/facets/shellwords.rb', line 30 def dos_escape(cmdline) '"' + cmdline.gsub(/\\(?=\\*\")/, "\\\\\\").gsub(/\"/, "\\\"").gsub(/\\$/, "\\\\\\").gsub("%", "%%") + '"' end |