fork / process and >

Started by newdep, May 20, 2008, 04:27:16 AM

Previous topic - Next topic

newdep

Hi Lutz,



Why does a (process {ls -la >}) executes and exits?

or (fork {ls -al >})) or (process "ls -al &>./file")



Im trying to get a script running with process but it

is redirecting data to i.e. &>/dev/null)



Process & fork start and exists newlisp right away..



(exec) does not work because the binary does not return instantly.

(process (first (exec ))) does also not work because the binary is not returning, not even with a & at the end..



So im stuck with (process) but the > spoils it..



Any idea?
-- (define? (Cornflakes))

newdep

#1
* edited posting *







The (process (first (exec ..))) has a big backdraw..



If the binary that should be executed does not return instantly then

newlisp is still blocking...





This works but does not return a PID ->



>(exec {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null &})

'()

>







This works but return the wrong PID ->



>(exec {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null &; echo $$})

'("1234")

>









This works, but waits forever->



>(exec {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null})









This does not work, because it exists ->



(process {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null})

(fork {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null})

1234

>

$prompt>









This blocks (when its '() or no direct stdout) ->



(process (first (exec {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null &}) ))









This returns the wrong pid ->



(fork (exec {/some/where/myfile 1 2 3 4 /anotherscript 2>/dev/null}))

12345

>









So actualy there is now no function in newlisp to put a program into the

background and grab the PID when it does not instantly return to the stdout/stderr.. (and thats my problem, I want to fork anything and always

have a pid, without newlisp exiting on me..)
-- (define? (Cornflakes))