{"id":4647,"date":"2014-03-30T14:16:00","date_gmt":"2014-03-30T14:16:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-prevent-ctrlbreak-ctrlc-from-closing-both-programs-if-one-was-launched-from-another-by-system-or-createprocess-collection-of-common-programming-errors\/"},"modified":"2014-03-30T14:16:00","modified_gmt":"2014-03-30T14:16:00","slug":"how-to-prevent-ctrlbreak-ctrlc-from-closing-both-programs-if-one-was-launched-from-another-by-system-or-createprocess-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-prevent-ctrlbreak-ctrlc-from-closing-both-programs-if-one-was-launched-from-another-by-system-or-createprocess-collection-of-common-programming-errors\/","title":{"rendered":"how to prevent Ctrl+Break\/Ctrl+C from closing both programs if one was launched from another by system() or CreateProcess()?-Collection of common programming errors"},"content":{"rendered":"<p>Add this::<\/p>\n<pre><code>#include \n\n ...\n\nsignal (SIGINT, SIG_IGN);\n<\/code><\/pre>\n<p>After the <code>signal()<\/code> call, the program ignores Ctrl-Break. On Linux, ignoring signals propagates to child processes through <code>fork()<\/code>\/<code>exec()<\/code>.<\/p>\n<p>I would expect Windows to reset the default signal handling on <code>exec()<\/code> due to the way the O\/S + runtime library work. So if you want the child to ignore <em>Break<\/em>, add the code above to it too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add this:: #include &#8230; signal (SIGINT, SIG_IGN); After the signal() call, the program ignores Ctrl-Break. On Linux, ignoring signals propagates to child processes through fork()\/exec(). I would expect Windows to reset the default signal handling on exec() due to the way the O\/S + runtime library work. So if you want the child to ignore [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4647","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4647"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4647\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}