...

Source file src/github.com/redhat-developer/odo/pkg/testingutil/system/default.go

Documentation: github.com/redhat-developer/odo/pkg/testingutil/system

     1  package system
     2  
     3  import "github.com/mitchellh/go-ps"
     4  
     5  type Default struct{}
     6  
     7  var _ System = Default{}
     8  
     9  func (o Default) FindProcess(pid int) (ps.Process, error) {
    10  	return ps.FindProcess(pid)
    11  }
    12  
    13  func (o Default) PidExists(pid int) (bool, error) {
    14  	processes, err := ps.Processes()
    15  	if err != nil {
    16  		return false, err
    17  	}
    18  	for _, process := range processes {
    19  		if process.Pid() == pid {
    20  			return true, nil
    21  		}
    22  	}
    23  	return false, nil
    24  }
    25  

View as plain text