gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/runtime/process/process.go (about)

     1  // Package process executes a binary
     2  package process
     3  
     4  import (
     5  	"io"
     6  
     7  	"gitee.com/liuxuezhan/go-micro-v1.18.0/runtime/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  }
    30  
    31  // PID is the running process
    32  type PID struct {
    33  	// ID of the process
    34  	ID string
    35  	// Stdin
    36  	Input io.Writer
    37  	// Stdout
    38  	Output io.Reader
    39  	// Stderr
    40  	Error io.Reader
    41  }