Ejemplo n.º 1
0
Archivo: file.go Proyecto: Andals/gpm
func (this *File) Write(msg []byte) (int, error) {
	// file may be deleted when doing logrotate
	if !misc.FileExist(this.path) {
		this.File, _ = openFile(this.path)
	}

	return this.File.Write(msg)
}
Ejemplo n.º 2
0
Archivo: file.go Proyecto: Andals/gobox
func (this *File) Write(msg []byte) (int, error) {
	// file may be deleted when doing logrotate
	if !misc.FileExist(this.path) {
		this.Close()
		this.File, _ = openFile(this.path)
	}

	<-this.lockCh
	n, err := this.File.Write(msg)
	this.lockCh <- 1

	return n, err
}
Ejemplo n.º 3
0
func ParsePackageConf(prjHome string) (*PackageConf, *exception.Exception) {
	confPath := getPackageJsonPath(prjHome)
	if !misc.FileExist(confPath) {
		return nil, exception.New(errno.E_CONF_PACKAGE_JSON_NOT_EXISTS, "There is no "+PACKAGE_JSON+" in "+prjHome)
	}

	var pkgJson packageJson

	jsonStr, _ := ioutil.ReadFile(confPath)
	err := json.Unmarshal(jsonStr, &pkgJson)
	if nil != err {
		return nil, exception.New(errno.E_CONF_PACKAGE_JSON_PARSE_ERROR, "Parse "+PACKAGE_JSON+" error")
	}

	return parseByJson(prjHome, &pkgJson)
}