github.com/annwntech/go-micro/v2@v2.9.5/runtime/local/process/process.go (about)

     1  // Package process executes a binary
     2  package process
     3  
     4  import (
     5  	"io"
     6  
     7  	"github.com/annwntech/go-micro/v2/runtime/local/build"
     8  )
     9  
    10  // Process manages a running process
    11  type Process interface {
    12  	// Executes a process to completion
    13  	Exec(*Executable) error
    14  	// Creates a new process
    15  	Fork(*Executable) (*PID, error)
    16  	// Kills the process
    17  	Kill(*PID) error
    18  	// Waits for a process to exit
    19  	Wait(*PID) error
    20  }
    21  
    22  type Executable struct {
    23  	// Package containing executable
    24  	Package *build.Package
    25  	// The env variables
    26  	Env []string
    27  	// Args to pass
    28  	Args []string
    29  	// Initial working directory
    30  	Dir string
    31  }
    32  
    33  // PID is the running process
    34  type PID struct {
    35  	// ID of the process
    36  	ID string
    37  	// Stdin
    38  	Input io.Writer
    39  	// Stdout
    40  	Output io.Reader
    41  	// Stderr
    42  	Error io.Reader
    43  }