Beispiel #1
0
func cmdstatus2json(s liblush.CmdStatus) (sjson statusJson) {
	sjson.Code = cmdstatus2int(s)
	if err := s.Err(); err != nil {
		sjson.ErrStr = err.Error()
	}
	return
}
Beispiel #2
0
func cmdstatus2int(s liblush.CmdStatus) (i int) {
	// not very pretty then again this entire integer status thing is bollocks
	// anyway might as well abuse it all the way
	if s.Err() != nil {
		return 3
	}
	if s.Exited() == nil {
		if s.Started() == nil {
			i = 0
		} else {
			i = 1
		}
	} else {
		if s.Success() {
			i = 2
		} else {
			i = 3
		}
	}
	return
}