// WritePidFile writes this a process id into a file.
// An error will be returned if the file already exists.
WritePidFile writes this a process id into a file.
An error will be returned if the file already exists.
// WritePidFile writes this a process id into a file . // An error will be returned if the file already exists .
func WritePidFile(pid int, filename string) error {
	pidString := strconv.Itoa(pid)
	pidFile, err := os.OpenFile(filename, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
	if err != nil {
		return err
	}
	defer pidFile.Close()
	_, err = pidFile.WriteString(pidString)
	return err
}
func WritePidFile ( pid int , filename string ) error { pidString := strconv . Itoa ( pid ) pidFile , err := os . OpenFile ( filename , os . O_CREATE | os . O_EXCL | os . O_WRONLY , 0644 ) if err != nil { return err } defer pidFile . Close ( ) _ , err = pidFile . WriteString ( pidString ) return err }
WritePidFile writes this a process id into a file.
WritePidFile writes this a process id into a file .