microsoft / microsoft/dcp

Ensure exec.Cmd.Path and exec.Cmd.Args[0] consistency

Open
#174 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

reliability
Dominant language
Go
Stars
189
Forks
24
Avg merge
2d 16h
Merged PRs (30d)
18

Description

Create a factory function for exec.Cmd so that we do not have to do the following all over the codebase

cmd := exec.Command("docker", args...)
// exec.Command resolves cmd.Path via LookPath but leaves cmd.Args[0] as
// the original "docker" string. Align Args[0] with the resolved Path so
// downstream consumers and child-process
// argv[0] observers see a consistent, fully-qualified command name.
if cmd.Path != "" {
	cmd.Args[0] = cmd.Path
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing exec.Command call sites and tracing how their Cmd values are consumed. Define the factory's scope from those uses, then verify that commands created through it have Args[0] aligned with the resolved Path and that all relevant call sites use the factory.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.