summaryrefslogtreecommitdiff
path: root/structs.go
blob: 1e0b692f12df17ca750fe47a6accc6256730063c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package shell

import "io"
import "os/exec"
import "bufio"
import "bytes"
import "github.com/svent/go-nbreader"

var FileMap	map[string]*File

var readBufferSize int

type File struct {
	Name		string
	// BufferSize	int
	// Buffer		*bytes.Buffer
	// Fbytes		[]byte
	TotalCount	int
	Empty		bool
	Dead		bool

	Fio		io.ReadCloser		// := process.StdoutPipe()
	Fbufio		*bufio.Reader		// := bufio.NewReader(pOUT)
	Fnbreader	*nbreader.NBReader	// := nbreader.NewNBReader(readOUT, 1024)
}

type Shell struct {
	Cmdline		string
	Process		*exec.Cmd
	Done		bool
	Quiet		bool
	Fail		bool
	Error		error
	Buffer		*bytes.Buffer

	// which names are really better here?
	// for now I init them both to test out
	// how the code looks and feels
	STDOUT		*File
	STDERR		*File
	Stdout		*File
	Stderr		*File
}

// default values for Shell
func New() *Shell {
	var tmp Shell

	tmp.Done = false
	tmp.Fail = false
	tmp.Quiet = quiet

	return &tmp
}