pipe

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)

Functions

func FilterNone

func FilterNone(string) bool

FilterNone is a filter that doesn't

func Kill

func Kill(w *Worker)

Kill sends a kill signal via the pipe logger

func LogServe

func LogServe(quit qu.C, appName string)

LogServe starts up a handler to listen to logs from the child process worker

func SetLevel

func SetLevel(w *Worker, level string)

SetLevel sets the level of logging from the worker

func SimpleLog

func SimpleLog(name string) func(ent *log.Entry) (e error)

SimpleLog is a very simple log printer

func Start

func Start(w *Worker)

func Stop

func Stop(w *Worker)

Stop running the worker

Types

type StdConn

type StdConn struct {
	io.ReadCloser
	io.WriteCloser
	Quit qu.C
}

func New

func New(in io.ReadCloser, out io.WriteCloser, quit qu.C) (s *StdConn)

func Serve

func Serve(quit qu.C, handler func([]byte) error) *StdConn

Serve runs a goroutine processing the FEC encoded packets, gathering them and decoding them to be delivered to a handler function

func (*StdConn) Close

func (s *StdConn) Close() (e error)

func (*StdConn) LocalAddr

func (s *StdConn) LocalAddr() (addr net.Addr)

func (*StdConn) Read

func (s *StdConn) Read(b []byte) (n int, e error)

func (*StdConn) RemoteAddr

func (s *StdConn) RemoteAddr() (addr net.Addr)

func (*StdConn) SetDeadline

func (s *StdConn) SetDeadline(t time.Time) (e error)

func (*StdConn) SetReadDeadline

func (s *StdConn) SetReadDeadline(t time.Time) (e error)

func (*StdConn) SetWriteDeadline

func (s *StdConn) SetWriteDeadline(t time.Time) (e error)

func (*StdConn) Write

func (s *StdConn) Write(b []byte) (n int, e error)

type Worker

type Worker struct {
	Cmd  *exec.Cmd
	Args []string
	// Stderr  io.WriteCloser
	// StdPipe io.ReadCloser
	StdConn *StdConn
}

func Consume

func Consume(
	quit qu.C,
	handler func([]byte) error,
	args ...string,
) *Worker

Consume listens for messages from a child process over a stdio pipe.

func LogConsume

func LogConsume(
	quit qu.C, handler func(ent *log.Entry) (e error),
	filter func(pkg string) (out bool), args ...string,
) *Worker

func Spawn

func Spawn(quit qu.C, args ...string) (w *Worker, e error)

Spawn starts up an arbitrary executable file with given arguments and attaches a connection to its stdin/stdout

func (*Worker) Continue

func (w *Worker) Continue() (e error)

Continue sends a signal to a worker process to resume work

func (*Worker) Interrupt

func (w *Worker) Interrupt() (e error)

Interrupt the child process. This invokes kill on windows because windows doesn't have an interrupt signal.

func (*Worker) Kill

func (w *Worker) Kill() (e error)

Kill forces the child process to shut down without cleanup

func (*Worker) Pause

func (w *Worker) Pause() (e error)

Pause sends a signal to the worker process to stop

func (*Worker) Stop

func (w *Worker) Stop() (e error)

Stop signals the worker to shut down cleanly.

Note that the worker must have handlers for os.Signal messages.

It is possible and neater to put a quit method in the IPC API and use the quit channel built into the StdConn

func (*Worker) Wait

func (w *Worker) Wait() (e error)

Wait for the process to finish running

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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