From: mame@... Date: 2020-03-29T05:17:55+00:00 Subject: [ruby-core:97614] [Ruby master Feature#16741] Implement Shellwords.shellescape correctly on Windows Issue #16741 has been updated by mame (Yusuke Endoh). I agree with @znz. IMO, a gem named `cmdwords` or something would be a good start for the feature instead of directly extending `shellwords`. ---------------------------------------- Feature #16741: Implement Shellwords.shellescape correctly on Windows https://bugs.ruby-lang.org/issues/16741#change-84804 * 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: