execcmd

package
v0.0.0-...-0117b6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package execcmd wraps up the os.Process interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecCmd

type ExecCmd struct {
	Cmd *exec.Cmd
}

implementation of IExecCmd with os.Process embed

func NewExecCmd

func NewExecCmd(command *exec.Cmd) *ExecCmd

NewExecCmd returns a new instance of the ExecCmd

func (*ExecCmd) Kill

func (p *ExecCmd) Kill() error

Kill causes the Process to exit immediately. Kill does not wait until the Process has actually exited. This only kills the Process itself, not any other processes it may have started.

func (*ExecCmd) Pid

func (p *ExecCmd) Pid() int

Pid returns the process id.

func (*ExecCmd) Signal

func (p *ExecCmd) Signal(sig os.Signal) error

Signal sends a signal to the command process

func (*ExecCmd) Start

func (p *ExecCmd) Start() error

Start starts the command execution process with the Cmd.

func (*ExecCmd) Wait

func (p *ExecCmd) Wait() error

Wait releases any resources associated with the Cmd.

type IExecCmd

type IExecCmd interface {
	Pid() int
	//kill the attached child process
	Kill() error
	//start the command execution process
	Start() error
	//wait for the child to finish
	Wait() error
	// sends a signal to the command process
	Signal(sig os.Signal) error
}

IExecCmd is an abstracted interface of os.Process

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL