I want to set TimeConstrained globally, I tried use $PrePrint as bellowed script:

$PrePrint = TimeConstrained[#,5] &;

But there's no effect, evaluation could not be aborted within given time.

So is there any way to do this? Thanks!

  • 2
    $\begingroup$ Consider $Pre and related items. $\endgroup$ – bbgodfrey Aug 31 '15 at 4:00
  • $\begingroup$ @bbgodfrey Thanks a lot. I found the solution by searching '$Pre'. $\endgroup$ – Michael Aug 31 '15 at 5:39

I found the solution in another topic here

How to stop the Kernel from running wild?

SetAttributes[timecon, HoldAll]
timecon[new_] := TimeConstrained[new, 5]
$Pre = timecon;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.