From: abobrikovich@... Date: 2020-03-28T18:16:03+00:00 Subject: [ruby-core:97611] [Ruby master Feature#16741] Implement Shellwords.shellescape correctly on Windows Issue #16741 has been reported by abobrikovich (Alexander Bobrikovich). ---------------------------------------- Feature #16741: Implement Shellwords.shellescape correctly on Windows https://bugs.ruby-lang.org/issues/16741 * Author: abobrikovich (Alexander Bobrikovich) * Status: Open * Priority: Normal ---------------------------------------- **Reproduce process** ```irb irb(main):002:0> require 'shellwords' => true irb(main):005:0> Shellwords.shellescape("/home/me/test with space.txt") => "/home/me/test\\ with\\ space.txt" ``` **Expected result and the reason why you expect** I understand that `shellwords` module originally was designed & developed for *NIX but I think it's a good chance to extend it to support Windows too For batch looks like quotation is a single option according to [2] if we need it, for example for paths that have space inside of it. Proposed implementation: ```irb irb(main):004:0> Shellwords.shellescape("C:\Program Files") => "\"C:\Program Files\"" ``` Current implementation: ```irb irb(main):004:0> Shellwords.shellescape("C:\Program Files") => "C:Program\\ Files" ``` Links 1. https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file 2. https://superuser.com/a/962816/245944 3. https://ss64.com/nt/syntax-esc.html -- https://bugs.ruby-lang.org/ Unsubscribe: