This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 70f5dc5c2 nshlib/nsh_fileapps: Print the PID of a background command.
70f5dc5c2 is described below

commit 70f5dc5c20ab52b5c0876a572c7d4a196840f1ba
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 10:43:00 2026 +0200

    nshlib/nsh_fileapps: Print the PID of a background command.
    
    nsh_fileapp() printed "cmd [pid:priority]" for a command in the
    background with ret as the PID.  ret is 0 after posix_spawnp()
    succeeds, so NSH printed "[0:...]" and the priority of NSH itself.
    
    Use the PID that posix_spawnp() returns.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 nshlib/nsh_fileapps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nshlib/nsh_fileapps.c b/nshlib/nsh_fileapps.c
index 25a9c27c2..352453628 100644
--- a/nshlib/nsh_fileapps.c
+++ b/nshlib/nsh_fileapps.c
@@ -374,8 +374,8 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char 
*cmd,
         {
           struct sched_param sched;
 
-          sched_getparam(ret, &sched);
-          nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, sched.sched_priority);
+          sched_getparam(pid, &sched);
+          nsh_output(vtbl, "%s [%d:%d]\n", cmd, pid, sched.sched_priority);
 
           /* Backgrounded commands always 'succeed' as long as we can start
            * them.

Reply via email to