I\'m looking how I can get exit code from non-child process.
As we all know there are few functions to work with child processes such as wait/waitpid. With this function
There is no POSIX or otherwise standard UNIX / Linux call to do what you ask, that I know of, but you can possibly accomplish it on Linux (or other UNIX) using the procfs. Many non-standard extensions were innovated with the procfs.
If the parent has not yet waited on the child, the return code may still be around.
See: Linux, where are the return codes stored of system daemons and other processes?