Hi,
in my program i need to run an external program in background.I am aware that there are at least 2 alternatives for this:
1)fork+exec
2)system("program &");
I have read several posts about this,and they all tend to suggest to use fork+exec (and that's what i am doing now).
I have some questions though:
a) I read somewhere that "system" actually uses fork+exec (and the man page for "system" implicitly seems to confirm it).Can you confirm this?
b)in the original source code i started working on,the external program was run like this:
I don't think that's correct for ay least 2 reasons:
a)it doesn't check WIFEXITED before checking WEXITSTATUS
b)since i am interested in the exit value of the external program,i think that this code is wrong since it wil output only the "system" exit code,and not the external program's one(consider that the external program will run for a while,so its exit code will be outputted much later).
Am i correct?
I would read your man page - the original code is correct - system does return the lower 8 bits (just like you get for wait) of the the exit status code of "process"
system returns -1 if fork() fails, otherwise it returns the exit status.
Dear community,
I communicate with an external program (maxima) using named pipes. If I use a text file to capture the output (maxima > out.txt) i can see the programs answer directly after the input written into the file. But if bypass the output into a named pipe (maxima > pipe) and capture it... (1 Reply)
Hi all,
I am using an external binary to view memory starting from a specific address and i want to automate this via PERL however there are problems. Hope you can help me ..thx
The output of the programme is like below:
bash-3.2$ mem_disp 12B21D20 100
Opening RO Data Memory File scp.ro... (4 Replies)
I need to run an interactive program in the background so I can grep it for specific data to use for some logic in a script.
There is no quiet or background mode on the program so I plan to redirect a document with commands in it and then to grep the output.
This is almost working, except... (1 Reply)
Hi, I was hoping for help with a for loop to run a program (vina) repeatedly using all the files in a folder as input. Currently my code looks like this:
#!/bin/bash
FILES=/home/afalk/Desktop/battest/*.pdbqt
for f in $FILES do
vina --config /home/afalk/Desktop/A.txt --ligand "$f".pdbqt
done... (5 Replies)
I have asked this before but I haven't had any luck so far getting this to work. I use RCS(revision control system). When it runs if I pass the value 'unlock' to $3 its reassigned to $unlock. When I run the command (rcs -u'version number' 'filename') ti will ask me 1-(Do you want to break the lock... (5 Replies)
Hello! I am currently attempting to build a very, very, basic program that attempts to act like a calendar for a "server." Using this program I need to have the client program connect to the server program, have the client wait for the server to respond through a socket, then exit and the server... (2 Replies)
Hi,
I have a query about processing and running Perl program at the background.
I have HTML file called Userform.html which accepts input from the user. As soon as input is given the contol goes to get.cgi (get.cgi does some processing and computing tasks).
Actually get .cgi takes more... (0 Replies)
Hello,
in the application i'm writing i need to launch "recordmydesktop" to capture the screen,but i'm having a problem: when the recording stops,and the encoding of the saved file starts,the entire system hangs until the completion of the encoding.This happens if i launch recordmydesktop from my... (7 Replies)
Hello
I am getting error when the file (Folder or Application) path having space is given as external input to the shell program.
It works fine for the files which has no spaces in the file name
Thans, (5 Replies)
This code is in my 'case' statement and it all else works fine.
The problem I have is that the value in 'procno' is not passed on to the external program (fireit).
It is passing all zeros instead of the actual process number.
By the time I get to this case statement, I know the "Number" and... (1 Reply)