shell

package
Version: v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package shell provides a 'cmd' channel type.

This package almost should be called 'cmd', but tends to have a special meaning in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdChan

func NewCmdChan(ctx *dsl.Ctx, cfg interface{}) (dsl.Chan, error)

NewCmdChan obviously makes a new CmdChan.

The cfg should represent a Process.

Types

type CmdChan

type CmdChan struct {
	// contains filtered or unexported fields
}

CmdChan is a channel that's backed by a subprocess.

This channel forwards messages to a shell's stdin, and messages written to the shell's stdout and stderr are emitted.

func (*CmdChan) Close

func (c *CmdChan) Close(ctx *dsl.Ctx) error

Close attempts to terminate the underlying process.

func (*CmdChan) DocSpec

func (c *CmdChan) DocSpec() *dsl.DocSpec

func (*CmdChan) Kill

func (c *CmdChan) Kill(ctx *dsl.Ctx) error

Kill is not currently supported. (It should be.)

ToDo: Terminate the subprocess ungracefully.

func (*CmdChan) Kind

func (c *CmdChan) Kind() dsl.ChanKind

func (*CmdChan) Open

func (c *CmdChan) Open(ctx *dsl.Ctx) error

Open starts the subprocess and the associated pipes.

func (*CmdChan) Pub

func (c *CmdChan) Pub(ctx *dsl.Ctx, m dsl.Msg) error

Pub sends the given message payload to the subprocess's stdin.

The topic is ignored.

func (*CmdChan) Recv

func (c *CmdChan) Recv(ctx *dsl.Ctx) chan dsl.Msg

func (*CmdChan) Sub

func (c *CmdChan) Sub(ctx *dsl.Ctx, topic string) error

Sub doesn't currently do anything.

ToDo: Have stdout and stderr "topics".

func (*CmdChan) To

func (c *CmdChan) To(ctx *dsl.Ctx, m dsl.Msg) error

To sends the given message payload to the subprocess's stdin.

The topic is ignored.

Source Files

Jump to

Keyboard shortcuts

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