feat: [#576] Add a new Cmd function for Running#1228
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Cmd() method to the Running interface and its implementation, allowing access to the underlying exec.Cmd instance of a running process. This addresses issue #576 by exposing the command object for external inspection or manipulation.
- Adds
Cmd()method toRunninginterface contract - Implements
Cmd()method inrunning.goto return the underlyingexec.Cmd - Updates mock implementation with generated mock code for the new method
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| contracts/process/running.go | Adds Cmd() method signature to the Running interface with documentation |
| process/running.go | Implements the Cmd() getter method to expose the internal cmd field |
| mocks/process/Running.go | Adds generated mock implementation for the new Cmd() method |
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 #1228 +/- ##
==========================================
- Coverage 66.69% 66.68% -0.01%
==========================================
Files 237 237
Lines 15918 15920 +2
==========================================
Hits 10617 10617
- Misses 4933 4935 +2
Partials 368 368 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📑 Description
Relate goravel/goravel#576
This pull request adds support for accessing the underlying
exec.Cmdinstance from theRunningprocess interface and its mock implementations. This enhancement allows consumers to interact directly with theexec.Cmdobject, which can be useful for advanced process management or inspection.API Enhancements:
Cmd()method to theRunninginterface incontracts/process/running.go, allowing retrieval of the underlying*exec.Cmdinstance.Cmd()method in the concreteRunningstruct inprocess/running.go, returning the stored*exec.Cmd.Testing and Mocking Improvements:
Runningstruct inmocks/process/Running.goto include a mockableCmd()method, with support for setting expectations and return values for tests.os/execimport to the mock file to support the new method.✅ Checks