{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14032","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14032/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14032/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14032/events","html_url":"https://github.com/JuliaLang/julia/pull/14032","id":117474937,"number":14032,"title":"RFC: more reliable & extensible ^C REPL interrupt","user":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-17T23:23:51Z","updated_at":"2015-11-18T20:16:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/14032","html_url":"https://github.com/JuliaLang/julia/pull/14032","diff_url":"https://github.com/JuliaLang/julia/pull/14032.diff","patch_url":"https://github.com/JuliaLang/julia/pull/14032.patch"},"body":"Instead of making task_done_hook aware of the REPL specifically,\r\nthis gives clients (such as the REPL) the ability to register a\r\nhandler for dealing with any exception that would otherwise not have a handler.\r\n\r\nFor example, the following code is valid. And while not recommended in this form,\r\nthis code is essentially a simple produce/consume pattern.\r\nIf you wait a few seconds, it will even finish.\r\n```julia\r\nfor i = 1:10^6; schedule(current_task()); yieldto(@task ()); end\r\n```\r\n\r\nHowever, on v0.4, hitting ^C might either accomplish nothing or infinitely cause a stack overflow segfault.\r\n\r\nwith this change, hitting ^C gets back to the REPL immediately.\r\n\r\n---\r\n\r\nThis can handle other sorts of exceptions, although\r\nin reality, the only unhandled exceptions are those that occur\r\nwhen trying to run task_done_hook or early on the root task.\r\nAccordingly, the most likely error is InterruptException,\r\nbut not exclusively.\r\n\r\nThis approach allows the REPL to print an error and return to a prompt,\r\neven when the Task state of eval_user_input is too inconsistent or\r\nunknown to be called directly.\r\n\r\nIf the last-chance exception handler returns or throws an error,\r\nthat that error is then considered to be finally fatal.\r\nThe return value when setting the exception handler allows the user\r\nto chain and reset the handler.\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/157849781","html_url":"https://github.com/JuliaLang/julia/pull/14032#issuecomment-157849781","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14032","id":157849781,"user":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T20:16:59Z","updated_at":"2015-11-18T20:16:59Z","body":"no, this would still kill every running task until it eventually managed to strike the user one. i think i may be able to put together a more general solution for that also helps with your IJulia case"}}