You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/01 12:48:11 UTC

[GitHub] [incubator-nuttx-apps] RoCorbera commented on a change in pull request #742: Change NSH kill cmd to accept SIGTERM as default

RoCorbera commented on a change in pull request #742:
URL: https://github.com/apache/incubator-nuttx-apps/pull/742#discussion_r643070372



##########
File path: nshlib/nsh_proccmds.c
##########
@@ -613,29 +614,54 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 #ifndef CONFIG_NSH_DISABLE_KILL
 int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 {
+/* kill will send SIGTERM to the task in case no signal is selected by
+ * -<signal> option
+ */
+
   char *ptr;
   char *endptr;
   long signal;
   long pid;
 
-  /* Check incoming parameters.  The first parameter should be "-<signal>" */
-
-  ptr = argv[1];
-  if (*ptr != '-' || ptr[1] < '0' || ptr[1] > '9')
+  if (argc == 3)  /* kill -<signal> <pid> */
     {
-      goto invalid_arg;
-    }
+      /* Check incoming parameters.
+       * The first parameter should be "-<signal>"
+       */
 
-  /* Extract the signal number */
+      ptr = argv[1];
+      if (*ptr != '-' || ptr[1] < '0' || ptr[1] > '9')

Review comment:
       Yes, it will be a good improvement for a next PR.




-- 
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:
users@infra.apache.org