github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/container_daemon/fake_spawner/FakeSpawner.go (about)

     1  // This file was generated by counterfeiter
     2  package fake_spawner
     3  
     4  import (
     5  	"os"
     6  	"os/exec"
     7  	"sync"
     8  
     9  	"github.com/cloudfoundry-incubator/garden-linux/container_daemon"
    10  )
    11  
    12  type FakeSpawner struct {
    13  	SpawnStub        func(cmd *exec.Cmd, withTty bool) ([]*os.File, error)
    14  	spawnMutex       sync.RWMutex
    15  	spawnArgsForCall []struct {
    16  		cmd     *exec.Cmd
    17  		withTty bool
    18  	}
    19  	spawnReturns struct {
    20  		result1 []*os.File
    21  		result2 error
    22  	}
    23  }
    24  
    25  func (fake *FakeSpawner) Spawn(cmd *exec.Cmd, withTty bool) ([]*os.File, error) {
    26  	fake.spawnMutex.Lock()
    27  	fake.spawnArgsForCall = append(fake.spawnArgsForCall, struct {
    28  		cmd     *exec.Cmd
    29  		withTty bool
    30  	}{cmd, withTty})
    31  	fake.spawnMutex.Unlock()
    32  	if fake.SpawnStub != nil {
    33  		return fake.SpawnStub(cmd, withTty)
    34  	} else {
    35  		return fake.spawnReturns.result1, fake.spawnReturns.result2
    36  	}
    37  }
    38  
    39  func (fake *FakeSpawner) SpawnCallCount() int {
    40  	fake.spawnMutex.RLock()
    41  	defer fake.spawnMutex.RUnlock()
    42  	return len(fake.spawnArgsForCall)
    43  }
    44  
    45  func (fake *FakeSpawner) SpawnArgsForCall(i int) (*exec.Cmd, bool) {
    46  	fake.spawnMutex.RLock()
    47  	defer fake.spawnMutex.RUnlock()
    48  	return fake.spawnArgsForCall[i].cmd, fake.spawnArgsForCall[i].withTty
    49  }
    50  
    51  func (fake *FakeSpawner) SpawnReturns(result1 []*os.File, result2 error) {
    52  	fake.SpawnStub = nil
    53  	fake.spawnReturns = struct {
    54  		result1 []*os.File
    55  		result2 error
    56  	}{result1, result2}
    57  }
    58  
    59  var _ container_daemon.Spawner = new(FakeSpawner)