Note that msg and errorCode are only present for abnormally terminated processes (i.e. those where the code is nonzero). Under the hood this command calls Tcl_WaitPid with the WNOHANG flag set for non-blocking behavior, unless the -wait switch is set (see below).
Additionally, ::tcl::process status accepts the following switches:
::tcl::process autopurge
→ true
::tcl::process autopurge false
→ false
set pid1 [exec command1 a b c | command2 d e f &]
→ 123 456
set chan [open "|command1 a b c | command2 d e f"]
→ file123
set pid2 [pid $chan]
→ 789 1011
::tcl::process list
→ 123 456 789 1011
::tcl::process status
→ 123 0
456 {1 "child killed: write on pipe with no readers" {
CHILDKILLED 456 SIGPIPE "write on pipe with no readers"}}
789 {1 "child suspended: background tty read" {
CHILDSUSP 789 SIGTTIN "background tty read"}}
1011 {}
::tcl::process status 123
→ 123 0
::tcl::process status 1011
→ 1011 {}
::tcl::process status -wait
→ 123 0
456 {1 "child killed: write on pipe with no readers" {
CHILDKILLED 456 SIGPIPE "write on pipe with no readers"}}
789 {1 "child suspended: background tty read" {
CHILDSUSP 789 SIGTTIN "background tty read"}}
1011 {1 "child process exited abnormally" {
CHILDSTATUS 1011 -1}}
::tcl::process status 1011
→ 1011 {1 "child process exited abnormally" {
CHILDSTATUS 1011 -1}}
::tcl::process purge
exec command1 1 2 3 &
→ 1213
::tcl::process list
→ 1213