Article 59T0M handle system function in case of hang

handle system function in case of hang

by
linxbee
from LinuxQuestions.org on (#59T0M)
I am using below program to launch another process using system function, i know it returns -1 in case we are not able to create process and not able to get the return status of child.

I wonder , in case if my "someprocess" hangs , what is the behavior, how to handle such scenario?

Code:#define SOMEPROCESS "/home/user/someprocess"

int main()
{
int ret = -1;

ret = system(SOMEPROCESS);

if( ret == -1 )
{
printf("problem in process execution\n");
}
else
{
printf("process execution success \n");
}
return 0;
}latest?d=yIl2AUoC8zA latest?i=MhoKKakvEOY:DpGEYS6IbE8:F7zBnMy latest?i=MhoKKakvEOY:DpGEYS6IbE8:V_sGLiP latest?d=qj6IDK7rITs latest?i=MhoKKakvEOY:DpGEYS6IbE8:gIN9vFwMhoKKakvEOY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments