MCPcopy Create free account
hub / github.com/Azure/powershell / _getCommandString

Method _getCommandString

lib/index.js:1800–1837  ·  view source on GitHub ↗
(options, noPrefix)

Source from the content-addressed store, hash-verified

1798 }
1799 }
1800 _getCommandString(options, noPrefix) {
1801 const toolPath = this._getSpawnFileName();
1802 const args = this._getSpawnArgs(options);
1803 let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
1804 if (IS_WINDOWS) {
1805 // Windows + cmd file
1806 if (this._isCmdFile()) {
1807 cmd += toolPath;
1808 for (const a of args) {
1809 cmd += ` ${a}`;
1810 }
1811 }
1812 // Windows + verbatim
1813 else if (options.windowsVerbatimArguments) {
1814 cmd += `"${toolPath}"`;
1815 for (const a of args) {
1816 cmd += ` ${a}`;
1817 }
1818 }
1819 // Windows (regular)
1820 else {
1821 cmd += this._windowsQuoteCmdArg(toolPath);
1822 for (const a of args) {
1823 cmd += ` ${this._windowsQuoteCmdArg(a)}`;
1824 }
1825 }
1826 }
1827 else {
1828 // OSX/Linux - this can likely be improved with some form of quoting.
1829 // creating processes on Unix is fundamentally different than Windows.
1830 // on Unix, execvp() takes an arg array.
1831 cmd += toolPath;
1832 for (const a of args) {
1833 cmd += ` ${a}`;
1834 }
1835 }
1836 return cmd;
1837 }
1838 _processLineBuffer(data, strBuffer, onLine) {
1839 try {
1840 let s = strBuffer + data.toString();

Callers 1

execMethod · 0.95

Calls 4

_getSpawnFileNameMethod · 0.95
_getSpawnArgsMethod · 0.95
_isCmdFileMethod · 0.95
_windowsQuoteCmdArgMethod · 0.95

Tested by

no test coverage detected