Philipp Traeder wrote:
> 
> > It is pretty simple, the perlipc man page has some good examples, but it
> > is basically like this:
> >
> >     elsif ( $cmd eq 'long_action' ) {
> >         defined( my $pid = fork ) or die "Cannot fork: $!";
> >         unless ( $pid ) {
> >             # execute the action in the child process
> >             sleep 10;
> >
> >             # TODO: notify the user that the action is finished.
> >             print "'long_action' has finished processing\n";
> >             exit;
> >         }
> >     }
> >
> 
> If I am not mistaken, this is more or less exactly what I am doing right
> now - the only problem I have got with this is that the user is
> interrupted in his work when the 'long_action' finishes - like this:
> 
>         myshell> long_action
>         initiating lengthy action...done.
> 
> now the user gets the focus back (which was the main reason behind this
> exercise), and types a new command
> 
>         myshell> some other command with some pa
> 
> In this very moment the long_action ends and prints
> 
>         'long_action' has finished processing
> 
> As you can see, the user has been interrupted in the middle of typing
> his statement, and it looks to him as if he would have lost his prompt.
> My initial reaction (as a user) to this behaviour would be to press
> enter - in this case the semi-complete command is executed because
> $term->readline is still reading keyboard input...

Probably the best way to do it (the way the Unix shell does it for mail
notification) is to output the message only when the user presses the
"Enter" key.  You could send a signal to the child when it is OK to
print the message or send the message to the parent and let it print it
at the appropriate time.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to