On Wed, May 13, 2020 at 10:28 PM Lucien Gentis <[email protected]> wrote: > > Hello, > > Distro : Debian 10 - 64bits > > I think it's the right list ; if not, please redirect me.
It is. > > In order to launch a command from within the C programme in attachment, I use > "fork - execve - wait" trio so that parent program waits until command has > finished > > Building the program : cc execve.c -o execve > > Program syntax : ./execve <command full path> > > Example : ./execve /usr/bin/gvim > > The problem : > > --- if I execute "./execve /usr/bin/gvim", gvim starts after a few seconds > but without executing .vimrc, and parent program doesn't wait for gvim to end. > > Output of "ps -auwx --forest" during the few wait seconds : > > lgentis 5216 0.0 0.0 7124 3812 pts/0 Ss 14:47 0:00 \_ bash > lgentis 9368 0.0 0.0 2144 752 pts/0 S+ 16:44 0:00 | \_ > ./execve /usr/bin/gvim > lgentis 9369 2.0 0.2 68916 16452 pts/0 S+ 16:44 0:00 | \_ > gvim > lgentis 9392 2.5 0.3 71620 22444 ? Ss 16:44 0:00 | > \_ gvim > > Output of "ps -auwx --forest" once gvim started : > > lgentis 5212 0.1 0.7 426212 43880 ? Rl 14:47 0:07 > xfce4-terminal > lgentis 5216 0.0 0.0 7124 3812 pts/0 Ss+ 14:47 0:00 \_ bash > lgentis 9093 1.3 0.4 75804 26700 ? Ss 16:36 0:00 gvim > > We can see that gvim is not a child process of the parent program (which has > ended) see :help -f > > --- if I execute "./execve /usr/bin/vim.gtk", vim starts in text mode in the > console ; however, parent program waits till vim is closed. > > Output of "ps -auwx --forest" : > > lgentis 5212 0.0 0.7 426212 43880 ? Rl 14:47 0:06 > xfce4-terminal > lgentis 5216 0.0 0.0 7124 3812 pts/0 Ss 14:47 0:00 \_ bash > lgentis 9011 0.0 0.0 2144 748 pts/0 S+ 16:34 0:00 | \_ > ./execve /usr/bin/vim.gtk > lgentis 9012 0.8 0.2 68932 17232 pts/0 S+ 16:34 0:00 | \_ > vim.gtk > > We can see that vim.gtk is a child process of the parent program > > --- I did the same test with gedit and audacious, and all works fine : child > program is executed and parent program waits as expected. > > Output of "ps -auwx --forest" : > > lgentis 5212 0.0 0.7 425664 43548 ? Sl 14:47 0:05 > xfce4-terminal > lgentis 5216 0.0 0.0 7124 3812 pts/0 Ss 14:47 0:00 \_ bash > lgentis 8910 0.0 0.0 2144 748 pts/0 S+ 16:30 0:00 | \_ > ./execve /usr/bin/gedit > lgentis 8911 4.2 0.7 477720 47812 pts/0 Sl+ 16:30 0:00 | \_ > gedit > > We can see that gedit is a child process of the parent program Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXt4s3BQ60Rj0byX8OpSEMVKm-d6r8Be0wGKmGzcP%2BKn7A%40mail.gmail.com.
