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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.