|
6 | 6 | spawn, |
7 | 7 | } from 'node:child_process'; |
8 | 8 | import type { Readable, Writable } from 'node:stream'; |
| 9 | +import { ui } from './logging.js'; |
9 | 10 | import { calcDuration } from './reports/utils.js'; |
10 | 11 |
|
11 | 12 | /** |
@@ -148,6 +149,10 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> { |
148 | 149 | const date = new Date().toISOString(); |
149 | 150 | const start = performance.now(); |
150 | 151 |
|
| 152 | + ui().logger.log( |
| 153 | + `Executing command:\n${[command, ...(args || [])].join(' ')}`, |
| 154 | + ); |
| 155 | + |
151 | 156 | return new Promise((resolve, reject) => { |
152 | 157 | // shell:true tells Windows to use shell command for spawning a child process |
153 | 158 | const spawnedProcess = spawn(command, args ?? [], { |
@@ -179,6 +184,8 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> { |
179 | 184 | const timings = { date, duration: calcDuration(start) }; |
180 | 185 | if (code === 0 || ignoreExitCode) { |
181 | 186 | onComplete?.(); |
| 187 | + // todo: maybe if I update spinner instead of logging it will appear with a command it was supposed to be grouped with |
| 188 | + ui().logger.log(`Command execution took ${calcDuration(start)}ms`); |
182 | 189 | resolve({ code, stdout, stderr, ...timings }); |
183 | 190 | } else { |
184 | 191 | const errorMsg = new ProcessError({ code, stdout, stderr, ...timings }); |
|
0 commit comments