www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Windows command line and execv

reply Kagamin <spam here.lot> writes:
Nick Sabalausky Wrote:

 Is execv known to
 trick the windows command-line into giving control back to the user?

on Linux though (assuming you add the proper "./", of course).

Looks like execv doesn't wait for application exit.
Aug 20 2010
parent reply Kagamin <spam here.lot> writes:
Kagamin Wrote:

 Is execv known to
 trick the windows command-line into giving control back to the user?

on Linux though (assuming you add the proper "./", of course).

Looks like execv doesn't wait for application exit.

Try to sleep after execv.
Aug 20 2010
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 08/20/2010 01:44 PM, Kagamin wrote:
 Kagamin Wrote:

 Is execv known to
 trick the windows command-line into giving control back to the user?

on Linux though (assuming you add the proper "./", of course).

Looks like execv doesn't wait for application exit.

Try to sleep after execv.

I think a form of join/wait is more appropriate. Andrei
Aug 20 2010
parent reply Kagamin <spam here.lot> writes:
Andrei Alexandrescu Wrote:

 Try to sleep after execv.

I think a form of join/wait is more appropriate.

That should be done inside execv. If one wants to join in user code, execv should return a waitable handle. Hmm msdn says it works in posix way. The problem seems to be cmd waits on parent process and when parent exits, cmd prints command prompt, but child is still running.
Aug 20 2010
parent Kagamin <spam here.lot> writes:
Kagamin Wrote:

 Hmm msdn says it works in posix way. The problem seems to be cmd waits on
parent process and when parent exits, cmd prints command prompt, but child is
still running.

No, it doesn't say it works in posix way, it only says execv doesn't return.
Aug 20 2010
prev sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Kagamin" <spam here.lot> wrote in message 
news:i4mif8$2p1r$1 digitalmars.com...
 Kagamin Wrote:

 Is execv known to
 trick the windows command-line into giving control back to the user?

fine on Linux though (assuming you add the proper "./", of course).

Looks like execv doesn't wait for application exit.

Try to sleep after execv.

execv always replaces the current process with the new one, so it never returns.
Aug 20 2010
parent "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:i4mmg2$a1i$1 digitalmars.com...
 "Kagamin" <spam here.lot> wrote in message 
 news:i4mif8$2p1r$1 digitalmars.com...
 Kagamin Wrote:

 Is execv known to
 trick the windows command-line into giving control back to the user?

works fine on Linux though (assuming you add the proper "./", of course).

Looks like execv doesn't wait for application exit.

Try to sleep after execv.

execv always replaces the current process with the new one, so it never returns.

(Contrary to phobos docs: http://d.puremagic.com/issues/show_bug.cgi?id=3158 )
Aug 20 2010