feat: [#576] Add a new TapCmd function for Process#1229
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a new TapCmd hook to allow callers to mutate the underlying exec.Cmd prior to process start, and removes direct exec.Cmd exposure from the Running interface for a cleaner abstraction.
- Introduces Process.TapCmd with storage and invocation of a user-supplied callback before cmd.Start.
- Removes Running.Cmd method and associated imports/mocks to hide internal exec.Cmd.
- Updates mocks to reflect the new TapCmd method and removed Cmd accessor.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/process/process.go | Declares new TapCmd method in Process interface with docs. |
| contracts/process/running.go | Removes Cmd() from Running interface and related exec import. |
| process/process.go | Adds tapCmd field, TapCmd method, and invokes callback before starting the process. |
| process/running.go | Removes concrete Running.Cmd method implementation. |
| mocks/process/Process.go | Adds mock support for TapCmd. |
| mocks/process/Running.go | Removes mock implementation of Cmd and related types/import. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1229 +/- ##
==========================================
- Coverage 66.68% 66.66% -0.03%
==========================================
Files 237 237
Lines 15920 15925 +5
==========================================
Hits 10617 10617
- Misses 4935 4939 +4
- Partials 368 369 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // TapCmd provides direct access to the underlying exec.Cmd before | ||
| // the process is started. This allows for advanced customization of | ||
| // the command, such as setting additional fields or modifying existing ones. | ||
| TapCmd(func(*exec.Cmd)) Process |
There was a problem hiding this comment.
Any example of such a customization that the Process interface doesn’t provide? And shouldn’t that be implemented inside process instead of exposing the internal command?
There was a problem hiding this comment.
Do you have any PR where this is happening?
krishankumar01
left a comment
There was a problem hiding this comment.
I will fix this issue in the my current PR or in a new one. For now, we can go ahead with this.

📑 Description
Relate goravel/goravel#576
This pull request introduces a new way to customize the underlying
exec.Cmdbefore starting a process, while also simplifying the process interface by removing direct access to theexec.Cmdfrom theRunninginterface. The main theme is to provide more flexible and controlled process customization, and to update the mocks and implementations accordingly.The interact command will be blocked if the cmd is not set like above. So add the new
TapCmdfunction.✅ Checks