def shelljoin(cmd, whitelist: SHELLJOIN_WHITELIST)
      cmd.map do |str|
        if whitelist.any? {|pat| str =~ pat }
          str
        else
          Shellwords.shellescape(str)
        end
      end.join(' ')
    end
def shelljoin(cmd, whitelist: SHELLJOIN_WHITELIST)
      cmd.map do |str|
        if whitelist.any? {|pat| str =~ pat }
          str
        else
          Shellwords.shellescape(str)
        end
      end.join(' ')
    end
An improved version of Shellwords.shelljoin that doesn't escape a few
 things.

 @param cmd [Array<String>] Command array to join.
 @param whitelist [Array<Regexp>] Array of patterns to whitelist.
 @return [String]