MCPcopy Index your code
hub / github.com/actions/toolkit / _getCommandString

Method _getCommandString

packages/exec/src/toolrunner.ts:37–77  ·  view source on GitHub ↗
(
    options: im.ExecOptions,
    noPrefix?: boolean
  )

Source from the content-addressed store, hash-verified

35 }
36
37 private _getCommandString(
38 options: im.ExecOptions,
39 noPrefix?: boolean
40 ): string {
41 const toolPath = this._getSpawnFileName()
42 const args = this._getSpawnArgs(options)
43 let cmd = noPrefix ? '' : '[command]' // omit prefix when piped to a second tool
44 if (IS_WINDOWS) {
45 // Windows + cmd file
46 if (this._isCmdFile()) {
47 cmd += toolPath
48 for (const a of args) {
49 cmd += ` ${a}`
50 }
51 }
52 // Windows + verbatim
53 else if (options.windowsVerbatimArguments) {
54 cmd += `"${toolPath}"`
55 for (const a of args) {
56 cmd += ` ${a}`
57 }
58 }
59 // Windows (regular)
60 else {
61 cmd += this._windowsQuoteCmdArg(toolPath)
62 for (const a of args) {
63 cmd += ` ${this._windowsQuoteCmdArg(a)}`
64 }
65 }
66 } else {
67 // OSX/Linux - this can likely be improved with some form of quoting.
68 // creating processes on Unix is fundamentally different than Windows.
69 // on Unix, execvp() takes an arg array.
70 cmd += toolPath
71 for (const a of args) {
72 cmd += ` ${a}`
73 }
74 }
75
76 return cmd
77 }
78
79 private _processLineBuffer(
80 data: Buffer,

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