mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 07:12:06 +08:00
nsh:support $! get last pid use nsh run
test: nsh> hello & hello [4:100] nsh> Hello, World!! nsh> echo $! 4 nsh> echo $! 3 nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 0069616 Idle_Task 1 1 224 FIFO Kthread - Waiting Signal 0000000000000000 0067536 loop_task 2 2 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067504 hpwork 0x45ae80 0x45aea8 3 3 100 FIFO Task - Running 0000000000000000 0067536 nsh_main nsh> Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -659,6 +659,11 @@ struct nsh_parser_s
|
||||
bool np_redir_out; /* true: Output from the last command was re-directed */
|
||||
bool np_redir_in; /* true: Input from the last command was re-directed */
|
||||
bool np_fail; /* true: The last command failed */
|
||||
pid_t np_lastpid; /* Pid of the last command executed */
|
||||
#ifdef NSH_HAVE_VARS
|
||||
char np_pids[32]; /* String representation of the last pid */
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
uint8_t np_flags; /* See nsh_npflags_e above */
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user