package lib

import (
	"bufio"
	"os"
	"strconv"
)

func WritePid() {
	fileName := "./server.pid"
	file, _ := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0666)
	defer file.Close()

	writer := bufio.NewWriter(file)

	pid := strconv.Itoa(os.Getpid())
	println("server_pid:", pid)
	writer.Write([]byte(pid))
	writer.Flush()
}
