I am sending emails in a program like so:
Call Shell(smtpPath, emailInput...)
This works great, except if I call the function twice, the function runs the first time, calls the shell command, then the function runs again, and calls the shell command again, but the first shell command is not completed, so there is an error because the second shell command is trying to use the same smtp file as the first one (that is still in use).
How can I make the function wait until the shell command has finished running?
Addendum: Or is there a way I can see if the file is being used, and if it is, sleep it, then try again?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…