(file: string, args: string[], options?: SpawnOptions)
| 11 | * Logs the running of a new process. Does not log stdout/stderr. |
| 12 | */ |
| 13 | export function logProcess(file: string, args: string[], options?: SpawnOptions) { |
| 14 | const argsList = args.reduce((accumulator, current, index) => { |
| 15 | let formattedArg = toCommandArgument(current); |
| 16 | if ( |
| 17 | (current.startsWith('"') && current.endsWith('"')) || |
| 18 | (current.startsWith("'") && current.endsWith("'") && (current.includes('/') || current.includes('\\'))) |
| 19 | ) { |
| 20 | formattedArg = `${current[0]}${getDisplayPath(current.substr(1))}`; |
| 21 | } |
| 22 | |
| 23 | return index === 0 ? formattedArg : `${accumulator} ${formattedArg}`; |
| 24 | }, ''); |
| 25 | |
| 26 | const message = [`Process Execution: ${getDisplayPath(file)} ${argsList}`]; |
| 27 | if (options && options.cwd) { |
| 28 | message.push(` > ${Logging.currentWorkingDirectory} ${getDisplayPath(options.cwd.toString())}`); |
| 29 | } |
| 30 | logger.info(message.join('\n')); |
| 31 | } |
no test coverage detected