So, I have this code to call the batch file.
If System.IO.file.Exists (FSourceFile) then the newer generation as the dim psi (batchfile lang + batchfilename) psi.RedirectStandardOutput = True psi.WindowStyle = System.Diagnostics.ProcessWindowStyle. Hidden psi.UseShellExecute = False dim my process Process = Start (PSI) as a slow output string = myProcess.StandardOutput.ReadToEnd () myProcess.WaitForExit (180000) if process (myProcess.HasExited) then throw new exception ("FTP Time Failed because of the outcome. Please check the connectivity of the FTP server ") End if FTPFile =" Success "End I want" myProcess " Sector to come out, if the batch file execution has not been completed within 3mins. But whenever the batch file execution is completed within less than 2 seconds, even then my process. If I put 2000 instead of 180000, then this process works fine. What is wrong with this?
myProcess.HasExited simply tells you whether the process has ended or if you are interested in the process If the reason has been exhausted, you should use
Iprocess.WaitForExit (180000) then throw a new exception ("FTP failed due to time-out. Please check connectivity FTP server. ") End if
No comments:
Post a Comment