in reply to Re: Run the process in the background
in thread Run the process in the background
Hej Monks,
I think i have caused too much confusion. I will rephrase the question.
First of all the environment: Linux(tcsh shell) and perl version 5.8.3.
Problem:
I want to do something like this
system("long command to be executed on the tcsh in the background &").
If i run this long command from the prompt it doesnt give me any error.
But If i run it using system and exec inside perl script (with or without fork), command is executed succesfully, prompt is returned but i get an error message on the prompt.
Scenarios that i have tried to perform as suggested by you all
=>using system function - system("command &") && die(" From Sys func: $!");
Executes my command and Returns the prompt but it gives an error after returning the prompt
"write to host (-1) failed in SendMessageToHost"
Note that i dont get illegal seek this time and the error mesg is not coming from die
=> using fork as suggested by cowboy with exec for executing the command on the shell
exec(" command &") && die("From Exec function: $!");
Prompt returns, gets the similar error
"write to host (-1) failed in SendMessageToHost"
=> using sys command inside fork or otherwise but having die as an OR condition
system("command &") || die("From sys function: $!");
This time i get "From sys function: Illegal seek" error
and then the prompt returns and gives the error
"write to host (-1) failed in SendMessageToHost"
Most of you have pointed out that the error may be coming from the command. Command works fine for me when i run it on the prompt. And i get these errors only from within perl script.
Thanx