cosash

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cosash implements a "co-processing" proxy that is primarily designed to expose a Go API that is currently implemented by `src/cmdlib.sh`. A lot of the code in that file is stateful - e.g. APIs set environment variables and allocate temporary directories. So it wouldn't work very well to fork a new shell process each time.

The "co-processing" here is a way to describe that there's intended to be a one-to-one relationship of the child bash process and the current one, although this is not strictly required. The Go APIs here call dynamically into the bash process by writing to its stdin, and can receive serialized data back over a pipe on file descriptor 3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CosaSh

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

CosaSh is a companion shell process which accepts commands piped over stdin.

func NewCosaSh

func NewCosaSh() (*CosaSh, error)

NewCosaSh creates a new companion shell process

func (*CosaSh) HasPrivileges

func (sh *CosaSh) HasPrivileges() (bool, error)

HasPrivileges checks if we can use sudo

func (*CosaSh) PrepareBuild

func (sh *CosaSh) PrepareBuild(artifact_name string) (string, error)

PrepareBuild prepares for a build, returning the newly allocated build directory

func (*CosaSh) Process

func (sh *CosaSh) Process(buf string) error

func (*CosaSh) ProcessWithReply

func (r *CosaSh) ProcessWithReply(buf string) (string, error)

write sends content to the shell's stdin, synchronously wait for the reply

Jump to

Keyboard shortcuts

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