You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bruce Perens edited this page Jun 14, 2020
·
10 revisions
On Unix-like systems, at initialization, Crystal opens:
A copy of each of stdin, stdout, and stderr if these are terminal devices. These would appear as file descriptors 3, 4, and 5 if all of stdin, stdout, and stderr are connected to a terminal.
Both ends of two pipes, for a total of 4 file descriptors. These are a kludge for signal handling. Since few libc functions are safe to call in a signal handler, Crystal catches signals, and writes to a pipe an indication that the signal was caught. Crystal's main select() or poll() loop will wake up on the pipe and receive that notification, and activate the user's signal handler.