0

I'am trying to call a program within my C++ code using system() function. Also I want to set an upper bound for runtime using Timeout. When I combine both using

system(timeout 10s ./app_to_launch)

the host C++ code seems to wait for 10s without launching app_to_launch. Can anyone help me understand what's happening ? Thanks :)

Alan Birtles
  • 32,622
  • 4
  • 31
  • 60
MejorSP
  • 31
  • 1
  • 1
    try https://stackoverflow.com/questions/52624004/running-a-process-using-boost-process-in-async-mode-with-timeout – Alan Birtles Jun 18 '21 at 12:48
  • 1
    Did you mean `system("timeout 10s ./app_to_launch")`? – John Bollinger Jun 18 '21 at 12:48
  • 1
    Your interpretation of your observations of the program's behavior is unlikely to be correct. And if indeed you get a ten-second delay then that strongly suggests that the C++ program is not (directly) the problem. My crystal ball tells me that when launched under control of `timeout`, the app in question does nothing visible to you for at least ten seconds. – John Bollinger Jun 18 '21 at 12:53
  • Yes I meant system("timeout 10s ./app_to_launch"). Also when I run the app in question using the same command but in a terminal it works. – MejorSP Jun 18 '21 at 13:31

0 Answers0