> (call "./p" "projects/rss-reader/word_index.l" "-" SockNum
> "-go" "-wait" ">>" "index.log" "2>&1" "&")
> to it. The above is not working like I want it to, I suspect I need to fork
Correct. 'call' will block until the called process terminates. The
other problem with the above is that the redirections ">>' and "2>&1"
won't work that way (these are features of the shell syntax).
You need to call a shell to have these features available:
(call "sh" "-c"
"./p projects/rss-reader/word_index.l - "
" -go -wait >>index.log 2>&1 &" ) )
> However I don't want to create a child here but a completely separate
> process. Could maybe (client) be used in some way or is there a better way?
You need a child process in some way, there is no other possibility to
create a process in Unix.
Instead of forking a shell (which terminates after spawning the PicoLisp
process), you could also get along with 'fork' only, something like:
This avoids spawning a separate shell, but has two disadvantages: The
child process inherits the whole environment from the parent, so this
should either be done when the parent starts to run, or the child should
clean up in some way (e.g. (rollback), (gc 0), close sockets etc.). And
redirection of stdout and stderr to a common destination is not such
easy (the child should do (out ...)) by itself.