summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error_buffer.go (renamed from buffer.go)18
-rw-r--r--static_pool.go2
-rw-r--r--worker.go6
3 files changed, 13 insertions, 13 deletions
diff --git a/buffer.go b/error_buffer.go
index c1265ccd..fcf566c8 100644
--- a/buffer.go
+++ b/error_buffer.go
@@ -5,33 +5,33 @@ import (
"sync"
)
-// thread safe buffer
-type buffer struct {
+// thread safe errBuffer
+type errBuffer struct {
mu sync.Mutex
buffer *bytes.Buffer
}
-// Len returns the number of bytes of the unread portion of the buffer;
+// Len returns the number of bytes of the unread portion of the errBuffer;
// b.Len() == len(b.Bytes()).
-func (b *buffer) Len() int {
+func (b *errBuffer) Len() int {
b.mu.Lock()
defer b.mu.Unlock()
return b.buffer.Len()
}
-// Write appends the contents of p to the buffer, growing the buffer as
+// Write appends the contents of p to the errBuffer, growing the errBuffer as
// needed. The return value n is the length of p; err is always nil. If the
-// buffer becomes too large, Write will panic with ErrTooLarge.
-func (b *buffer) Write(p []byte) (n int, err error) {
+// errBuffer becomes too large, Write will panic with ErrTooLarge.
+func (b *errBuffer) Write(p []byte) (n int, err error) {
b.mu.Lock()
defer b.mu.Unlock()
return b.buffer.Write(p)
}
-// Strings fetches all buffer data into string.
-func (b *buffer) String() string {
+// Strings fetches all errBuffer data into string.
+func (b *errBuffer) String() string {
b.mu.Lock()
defer b.mu.Unlock()
diff --git a/static_pool.go b/static_pool.go
index c0075c8f..cc2b38ab 100644
--- a/static_pool.go
+++ b/static_pool.go
@@ -30,7 +30,7 @@ type StaticPool struct {
// active task executions
tasks sync.WaitGroup
- // workers circular allocation buffer
+ // workers circular allocation errBuffer
free chan *Worker
// protects state of worker list, does not affect allocation
diff --git a/worker.go b/worker.go
index 65088570..e33ea327 100644
--- a/worker.go
+++ b/worker.go
@@ -36,7 +36,7 @@ type Worker struct {
// err aggregates stderr output from underlying process. Value can be
// receive only once command is completed and all pipes are closed.
- err *buffer
+ err *errBuffer
// channel is being closed once command is complete.
waitDone chan interface{}
@@ -60,12 +60,12 @@ func newWorker(cmd *exec.Cmd) (*Worker, error) {
w := &Worker{
Created: time.Now(),
cmd: cmd,
- err: &buffer{buffer: new(bytes.Buffer)},
+ err: &errBuffer{buffer: new(bytes.Buffer)},
waitDone: make(chan interface{}),
state: newState(StateInactive),
}
- // piping all stderr to command buffer
+ // piping all stderr to command errBuffer
w.cmd.Stderr = w.err
return w, nil