Chapter 8

  1. What's an exit code? Who makes use of it?
    The exit code is an integer value passed from a process to is parent to signal when the process ends. It represents the outcome of the process, and it is 0 if there have been no errors. The parent process can use this value to decide what to do next, such as running the process again if there is an error.
  2. What happens when an application panics? What exit code is returned?
    If  panic is not recovered, the application will execute all the deferred functions and will exit with a status of 2.
  3. What's the default behavior of a Go application when receiving all signals?
    The default behavior of a Go application with signals is an early exit.
  4. How do you intercept signals and decide how the application must behave?
    The signals received can be intercepted using the signal.Notify method on a channel, specifying the type of signals that you want to handle. The values received by the channel can be compared to signal values, and the application can behave accordingly.
  5. Can you send signals to other processes? If so, how?
    It is possible to send signals to another process inside a Go application. In order to do so, the application needs to acquire an instance of the os.Process structure using a lookup function, and then it can use the Signal method of the structure to send a signal.
  6. What are pipes and why are they important?
    Pipes are two streams, one of output and the other of input, connected together. What's written in the output is available to the input, and this facilitates the connection of one process output to another process input.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.103.219