Skip to content

Comments

feat: [#576] Add a new TapCmd function for Process#1229

Merged
hwbrzzl merged 1 commit intomasterfrom
bowen/#576-4
Oct 16, 2025
Merged

feat: [#576] Add a new TapCmd function for Process#1229
hwbrzzl merged 1 commit intomasterfrom
bowen/#576-4

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Oct 15, 2025

📑 Description

Relate goravel/goravel#576

This pull request introduces a new way to customize the underlying exec.Cmd before starting a process, while also simplifying the process interface by removing direct access to the exec.Cmd from the Running interface. The main theme is to provide more flexible and controlled process customization, and to update the mocks and implementations accordingly.

image

The interact command will be blocked if the cmd is not set like above. So add the new TapCmd function.

✅ Checks

  • Added test cases for my code

@hwbrzzl hwbrzzl requested a review from a team as a code owner October 15, 2025 12:51
Copilot AI review requested due to automatic review settings October 15, 2025 12:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.66%. Comparing base (88bdeab) to head (961b597).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
process/process.go 0.00% 6 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The interact command will be blocked if the cmd is not set like above. So add the new TapCmd function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any PR where this is happening?

Copy link
Member

@krishankumar01 krishankumar01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this issue in the my current PR or in a new one. For now, we can go ahead with this.

@hwbrzzl hwbrzzl merged commit 70a0c80 into master Oct 16, 2025
12 of 14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#576-4 branch October 16, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants