Azure / Azure/azure-dev

Command runner logging enhancements with `--debug`

Open
#5,502 2 comments 0 reactions 0 assignees View on GitHub
area/telemetry enhancement
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

One current limitation of the command runner implementation is that when running azd with `--debug`, if the command being executed takes a very long time or appears to be stuck, neither the command or output gets logged until the process exits.

-----------------------------

_Originally posted by @weikanglim in https://github.com/Azure/azure-dev/issues/5501#issuecomment-3085257044_:

Right now our command runner only logs the full output of the command after execution:

> 2025/07/17 19:22:52 command_runner.go:310: Run exec: 'git --version' , exit code: 0
-------------------------------------stdout-------------------------------------------
git version 2.45.3

A possible enhancement is to split this out into two messages:

> 2025/07/17 19:22:52 command_runner.go:310: Start: 'git --version'
> 2025/07/17 19:22:52 command_runner.go:310: Stop: 'git --version' , exit code: 0
-------------------------------------stdout-------------------------------------------
git version 2.45.3

-----------------------------

A further enhancement could be to support streaming the command output in real-time, which would make it easier to observe and debug cases like #5491, where the command being executed initiated a long-running process:

```
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5241
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /workspaces/junk_20250716/Something
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.