baanbab
24th June 2002, 22:14
Can anyone help me on this!!

I am using the shell function in my program for e-mailing from Baan.

ret = shell(mail.msg, SHELL_BACKGROUND)

This function is executed in a loop in the sense that it picks up the e-mail id from a table and e-mails a file. If the table has 200 records then this function is will be executed 200 times.

Today I got a problem when I ran the session. The session created a small Baan Window with "message" title and it said...
"FATAL ERROR: PTY error: 'No more pty's available' (e=0) PRESS <RETURN>"

There were a number of Baan windows with this message and had to go to each window and press return to come out of it.

But this did not affect my session it did work fine. But I am not sure if the shell function worked. I guess the command which I gave in Shell function "sendmail" failed. None of the e-mails were sent.

Can anyone help me to know about this FATAL ERROR


Thanks,
Babu

patvdv
24th June 2002, 22:33
Chance is that you have run into the threshold of the maximum number of defined PTY's in your UNIX kernel. If you start running into this problem consistently then you should consider increasing this.

~Vamsi
24th June 2002, 22:36
How about not using "shell" which is deprecated. Use "run.prog" instead. I would also look into the possibility of calling the run.prog once with a bunch of email addresses which are handled by a shell script instead of one instance of the shell script per email address.

NPRao
24th June 2002, 23:32
Hi Babu,

As Pat says you are breaking the pty's limits on your systems.

I used similar kind of coding but I never got into trouble.

You might try this option -

use

ret = shell(mail.msg, 0) instead of

ret = shell(mail.msg, SHELL_BACKGROUND)


Syntax

long shell( string command(.), long mode )

command The command to be executed.
mode - This can be a combination of the following options:
0 - No main window is created for the terminal emulator. This may result in starting a terminal emulator in the main window of the process that calls the shell function. The first status field displays "ottstpvtemul" while the shell process is running.

© 1998 Baan Development B.V. All rights reserved


Vamsi, is right about the deprecation with shell() but I still use it as I think it is better than the run.prog()


long run.prog( const string progname, const string arguments, long mode )
mode This specifies the execution mode of the program or command. The possible values are:RP_WAIT - wait for the program to finish
RP_NOWAIT run as a background program

© 1998 Baan Development B.V. All rights reserved


I think safe option is using the mode - RP_WAIT

NPRao
24th June 2002, 23:51
checking back into the Email DLL I built sometime ago, here is the logical part of it -


email.addr = " " & strip$(sendto) & " < "
|* safe option to use the email id directly
endselect
email.comm = "echo test|mailx -s " & subject & email.addr & filename
e = shell(email.comm, 0)


I never had any issue with it.

Vamsi, has a good idea that you can use multiple email addresses at the same time. I cant find the documentations/related emails with info, but I think there is a characters limit [~256] to the command+arguments which can be used with shell().