func WaitPID(action *recipe.Action) error {
	var timeout float64
	pidFile, err := action.GetS(0)
	if err != nil {
		return err
	}
	if action.Has(1) {
		timeout, err = action.GetF(1)
		if err != nil {
			return err
		}
	} else {
		timeout = 60.0
	}
	start := time.Now()
	timeout = mathutil.BetweenF64(timeout, 0.01, 3600.0)
	timeoutDur := timeutil.SecondsToDuration(timeout)
	for range time.NewTicker(25 * time.Millisecond).C {
		if time.Since(start) >= timeoutDur {
			break
		}
		switch {
		case !action.Negative && fsutil.IsExist(pidFile):
			ppid := pid.Read(pidFile)
			if ppid == -1 {
				continue
			}
			if fsutil.IsExist("/proc/" + strconv.Itoa(ppid)) {
				return nil
			}
		case action.Negative && !fsutil.IsExist(pidFile):
			time.Sleep(time.Second)
			return nil
		}
	}
	switch action.Negative {
	case false:
		return fmt.Errorf("Timeout (%g sec) reached, and PID file %s didn't appear", timeout, pidFile)
	default:
		return fmt.Errorf("Timeout (%g sec) reached, and PID file %s still exists", timeout, pidFile)
	}
}
WaitPID is action processor for "wait-pid"
package action
import (
	"fmt"
	"net"
	"os"
	"os/exec"
	"strconv"
	"strings"
	"syscall"
	"time"
	"pkg.re/essentialkaos/ek.v12/env"
	"pkg.re/essentialkaos/ek.v12/fsutil"
	"pkg.re/essentialkaos/ek.v12/mathutil"
	"pkg.re/essentialkaos/ek.v12/pid"
	"pkg.re/essentialkaos/ek.v12/signal"
	"pkg.re/essentialkaos/ek.v12/timeutil"
	"github.com/essentialkaos/bibop/recipe"
)
var ErrCantReadPIDFile = fmt.Errorf("Can't read PID from PID file")
func ProcessWorks(action *recipe.Action) error {
	pidFile, err := action.GetS(0)
	if err != nil {
		return err
	}
	ppid := pid.Read(pidFile)
	if ppid == -1 {
		return ErrCantReadPIDFile
	}
	isWorks := fsutil.IsExist("/proc/" + strconv.Itoa(ppid))
	switch {
	case !action.Negative && !isWorks:
		return fmt.Errorf("Process with PID %d from PID file %s doesn't exist", ppid, pidFile)
	case action.Negative && isWorks:
		return fmt.Errorf("Process with PID %d from PID file %s exists", ppid, pidFile)
	}
	return err
}