starsz commented on a change in pull request #1333:
URL: https://github.com/apache/apisix-dashboard/pull/1333#discussion_r560693660



##########
File path: api/cmd/managerapi.go
##########
@@ -119,5 +132,28 @@ func NewManagerAPICommand() *cobra.Command {
        }
 
        cmd.PersistentFlags().StringVarP(&conf.WorkDir, "work-dir", "p", ".", 
"current work directory")
+
+       cmd.AddCommand(newStopCommand())
+       return cmd
+}
+
+func newStopCommand() *cobra.Command {
+       cmd := &cobra.Command{
+               Use: "stop",
+               Run: func(cmd *cobra.Command, args []string) {
+                       pid, err := utils.ReadPID(conf.PIDPath)
+                       if err != nil {
+                               if syscall.ENOENT.Error() == err.Error() {
+                                       fmt.Fprintf(os.Stderr, "failed to get 
manager-api pid: %s\n", err)
+                               } else {
+                                       fmt.Fprintf(os.Stderr,  "pid path %s 
not found, is manager-api running?\n", conf.PIDPath)
+                               }

Review comment:
       I think we should log the error info here.
   
   `syscall.ENOENT.Error() == err.Error()` ? 
   Maybe `syscall.ENOENT.Error() != err.Error()`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to