mirror of https://github.com/dapr/cli.git
29 lines
446 B
Go
29 lines
446 B
Go
package standalone
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
func Stop(appID string) error {
|
|
apps, err := List()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, a := range apps {
|
|
if a.AppID == appID {
|
|
pid := fmt.Sprintf("%v", a.PID)
|
|
if runtime.GOOS == "windows" {
|
|
err := runCmd("taskkill", "/F", "/PID", pid)
|
|
return err
|
|
} else {
|
|
err := runCmd("kill", pid)
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("couldn't find app id %s", appID)
|
|
}
|