示例#1
0
文件: util.go 项目: akutz/rexray
// ReadSpecFile reads the REX-Ray host address from the spec file.
func ReadSpecFile() (string, error) {
	host, err := gotil.ReadFileToString(SpecFilePath())
	if err != nil {
		return "", err
	}
	return gotil.Trim(host), nil
}
示例#2
0
文件: util.go 项目: akutz/rexray
// ReadPidFile reads the REX-Ray PID from the PID file.
func ReadPidFile() (int, error) {
	pidStr, pidStrErr := gotil.ReadFileToString(PidFilePath())
	if pidStrErr != nil {
		return -1, pidStrErr
	}
	pid, atoiErr := strconv.Atoi(pidStr)
	if atoiErr != nil {
		return -1, atoiErr
	}
	return pid, nil
}