Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem executing kshell

Status
Not open for further replies.

Kenrae

Programmer
Feb 7, 2001
174
ES
Hi all,

I have a program, named execute, which executes a command using kshell. I use an execl call like this:
Code:
 execl("/usr/bin/ksh", "ksh", "-m", "-c", command, 0);
I catch the output using pipes, and it works fine. The problem comes when I want to run a background process. Sometimes, I don't want my program to wait for the end of the command. I supposed that using '&' would do the job, but ksh still waits for its termination. The problem is that I need to wait for ksh to end, but sometimes I don't want ksh to wait for 'command' to end.
Any ideas?

Thank's in advance.
 
If someone want to know...
I finally used a workaround to solve it. I parsed the command myself, and detected whether it was a background command or not. Then, I wait myself for the ksh or not. When it's a background command, I use a log file to store the end status.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top