agent: unexport ExecServer → execServer
No external callers — only used internally by the detach methods (Detach, ListDetached, SignalDetached, GetDetachedOutput, DismissDetached). The accessor is now private, no longer leaking the dispatcher interface.
This commit is contained in:
parent
8acb4a901e
commit
cde16ada08
|
|
@ -475,9 +475,8 @@ func (ag *Agent) React(responseID, emoji string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ExecServer returns the execute server interface, or nil if unavailable.
|
||||
// NOTE: This is temporary — detach operations should be proper Agent methods.
|
||||
func (ag *Agent) ExecServer() interface{} {
|
||||
// execServer returns the execute server interface, or nil if unavailable.
|
||||
func (ag *Agent) execServer() interface{} {
|
||||
if ag.runtime == nil || ag.runtime.Dispatcher == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -513,7 +512,7 @@ func (ag *Agent) WaitForChange(ctx context.Context) {
|
|||
|
||||
// Detach detaches the current running process to background.
|
||||
func (ag *Agent) Detach() bool {
|
||||
if srv := ag.ExecServer(); srv != nil {
|
||||
if srv := ag.execServer(); srv != nil {
|
||||
if d, ok := srv.(interface{ Detach() bool }); ok {
|
||||
return d.Detach()
|
||||
}
|
||||
|
|
@ -532,7 +531,7 @@ type DetachedInfo struct {
|
|||
|
||||
// ListDetached returns info about all detached processes.
|
||||
func (ag *Agent) ListDetached() []DetachedInfo {
|
||||
srv := ag.ExecServer()
|
||||
srv := ag.execServer()
|
||||
if srv == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -559,7 +558,7 @@ func (ag *Agent) ListDetached() []DetachedInfo {
|
|||
|
||||
// SignalDetached sends a signal to a detached process.
|
||||
func (ag *Agent) SignalDetached(pid int, signal int) error {
|
||||
if srv := ag.ExecServer(); srv != nil {
|
||||
if srv := ag.execServer(); srv != nil {
|
||||
type signaler interface{ SignalDetached(int, syscall.Signal) error }
|
||||
if sg, ok := srv.(signaler); ok {
|
||||
return sg.SignalDetached(pid, syscall.Signal(signal))
|
||||
|
|
@ -570,7 +569,7 @@ func (ag *Agent) SignalDetached(pid int, signal int) error {
|
|||
|
||||
// GetDetachedOutput reads output from a detached process.
|
||||
func (ag *Agent) GetDetachedOutput(pid int) (string, error) {
|
||||
if srv := ag.ExecServer(); srv != nil {
|
||||
if srv := ag.execServer(); srv != nil {
|
||||
type outputGetter interface{ GetDetachedOutput(int) (string, error) }
|
||||
if og, ok := srv.(outputGetter); ok {
|
||||
return og.GetDetachedOutput(pid)
|
||||
|
|
@ -581,7 +580,7 @@ func (ag *Agent) GetDetachedOutput(pid int) (string, error) {
|
|||
|
||||
// DismissDetached removes a finished detached process.
|
||||
func (ag *Agent) DismissDetached(pid int) bool {
|
||||
if srv := ag.ExecServer(); srv != nil {
|
||||
if srv := ag.execServer(); srv != nil {
|
||||
type dismisser interface{ DismissDetached(int) bool }
|
||||
if d, ok := srv.(dismisser); ok {
|
||||
return d.DismissDetached(pid)
|
||||
|
|
|
|||
Reference in New Issue