0

I have used the code given here: https://stackoverflow.com/a/6001858/282155

For cmd, I am giving .exe of my c++ program. The solution given there works out for Timeout. But when my c++ program crashes in run-time I want to return non-zero from RunCmd.Run()

For this, as mentioned by Eli Bandersky in How to get exit code when using Python subprocess communicate method? I added the following line:

return self.p.returncode

But this returns zero.

Community
  • 1
  • 1
Kaushik Acharya
  • 1,520
  • 2
  • 16
  • 25
  • Please remember to tag your questions with the language. – Barmar Jun 21 '13 at 06:03
  • Please show some code... – Sylvain Leroux Jun 21 '13 at 08:20
  • ... in addition, what does it mean "the program crash"? Does that program correctly set its return status to non-zero on case of abnormal termination? – Sylvain Leroux Jun 21 '13 at 08:21
  • @Sylvian, The code exactly like its there in thread# 4158502 (The first link I mentioned). a) The difference is at the end i had put return self.p.returncode. b) The crash happens in c++ code mentioned as [b]cmd[/b] in run time for some cases. To give a simple example: In c++ code: float df = 4.5/gh; //say gh=0 in some cases – Kaushik Acharya Jun 21 '13 at 10:03

0 Answers0