This is weird (for me). When I do sh -c ./p
projects/rss-reader/word_index.l - 1 -go -wait >> index.log 2>&1 & in
a shell the server starts but when I do (call "sh" "-c" "./p
projects/rss-reader/word_index.l - 1 -go -wait >> index.log 2>&1 &")
it doesn't.

I must be missing something fundamental?



On Fri, sh -c ./p projects/rss-reader/word_index.l - 1 -go -wait >>
index.log 2>&1 &Feb 5, 2010 at 11:21 AM, Alexander Burger
<a...@software-lab.de> wrote:
> Hi Henrik,
>
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (call "./p" "projects/rss-reader/wor=
d_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 f=
ork
>
> 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:
>
> =A0 (call "sh" "-c"
> =A0 =A0 =A0(pack
> =A0 =A0 =A0 =A0 "./p projects/rss-reader/word_index.l - "
> =A0 =A0 =A0 =A0 Socknum
> =A0 =A0 =A0 =A0 " -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 w=
ay?
>
> 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:
>
> =A0 (unless (fork)
> =A0 =A0 =A0(load "projects/rss-reader/word_index.l")
> =A0 =A0 =A0(do-something-with Socknum)
> =A0 =A0 =A0(go)
> =A0 =A0 =A0(wait) )
>
> 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.
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to