(arg)
| 20165 | return this._endsWith(upperToolPath, ".CMD") || this._endsWith(upperToolPath, ".BAT"); |
| 20166 | } |
| 20167 | _windowsQuoteCmdArg(arg) { |
| 20168 | if (!this._isCmdFile()) { |
| 20169 | return this._uvQuoteCmdArg(arg); |
| 20170 | } |
| 20171 | if (!arg) { |
| 20172 | return '""'; |
| 20173 | } |
| 20174 | const cmdSpecialChars = [ |
| 20175 | " ", |
| 20176 | " ", |
| 20177 | "&", |
| 20178 | "(", |
| 20179 | ")", |
| 20180 | "[", |
| 20181 | "]", |
| 20182 | "{", |
| 20183 | "}", |
| 20184 | "^", |
| 20185 | "=", |
| 20186 | ";", |
| 20187 | "!", |
| 20188 | "'", |
| 20189 | "+", |
| 20190 | ",", |
| 20191 | "`", |
| 20192 | "~", |
| 20193 | "|", |
| 20194 | "<", |
| 20195 | ">", |
| 20196 | '"' |
| 20197 | ]; |
| 20198 | let needsQuotes = false; |
| 20199 | for (const char of arg) { |
| 20200 | if (cmdSpecialChars.some((x) => x === char)) { |
| 20201 | needsQuotes = true; |
| 20202 | break; |
| 20203 | } |
| 20204 | } |
| 20205 | if (!needsQuotes) { |
| 20206 | return arg; |
| 20207 | } |
| 20208 | let reverse = '"'; |
| 20209 | let quoteHit = true; |
| 20210 | for (let i = arg.length; i > 0; i--) { |
| 20211 | reverse += arg[i - 1]; |
| 20212 | if (quoteHit && arg[i - 1] === "\\") { |
| 20213 | reverse += "\\"; |
| 20214 | } else if (arg[i - 1] === '"') { |
| 20215 | quoteHit = true; |
| 20216 | reverse += '"'; |
| 20217 | } else { |
| 20218 | quoteHit = false; |
| 20219 | } |
| 20220 | } |
| 20221 | reverse += '"'; |
| 20222 | return reverse.split("").reverse().join(""); |
| 20223 | } |
| 20224 | _uvQuoteCmdArg(arg) { |
no test coverage detected