示例#1
0
文件: update.go 项目: devick/flynn
func (u *Update) getPath() (string, error) {
	if u.TargetPath == "" {
		return osext.Executable()
	} else {
		return u.TargetPath, nil
	}
}
示例#2
0
文件: check.go 项目: devick/flynn
func defaultChecksum() string {
	path, err := osext.Executable()
	if err != nil {
		return ""
	}

	checksum, err := update.ChecksumForFile(path)
	if err != nil {
		return ""
	}

	return hex.EncodeToString(checksum)
}
示例#3
0
文件: git.go 项目: supermario/flynn
func writeGlobalGitConfig(domain, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.https://git.%s.sslCAInfo", domain), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}
	if err := gitConfig(fmt.Sprintf("credential.https://git.%s.helper", domain), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
示例#4
0
文件: git.go 项目: rikur/flynn
func WriteGlobalGitConfig(gitURL, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.%s.sslCAInfo", gitURL), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}
	if err := gitConfig(fmt.Sprintf("credential.%s.helper", gitURL), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
示例#5
0
文件: git.go 项目: devick/flynn
func WriteGlobalGitConfig(gitURL, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.%s.sslCAInfo", gitURL), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}

	// Ensure the path uses `/`s
	// Git on windows can't handle `\`s
	self = filepath.ToSlash(self)

	if err := gitConfig(fmt.Sprintf("credential.%s.helper", gitURL), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
示例#6
0
文件: update.go 项目: n1rvana/flynn
func (u *Updater) backgroundRun() {
	if u == nil {
		return
	}
	if !u.wantUpdate() {
		return
	}
	self, err := osext.Executable()
	if err != nil {
		// fail update, couldn't figure out path to self
		return
	}
	// TODO(titanous): logger isn't on Windows. Replace with proper error reports.
	l := exec.Command("logger", "-tflynn")
	c := exec.Command(self, "update")
	if w, err := l.StdinPipe(); err == nil && l.Start() == nil {
		c.Stdout = w
		c.Stderr = w
	}
	c.Start()
}