Advertisement
robertbira

Italian Translation Report: Node.js [Part 36 - 1200 words]

Sep 19th, 2018
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. The method is generally identical to with the exception that the method will not return until the child process has fully closed.
  2. When a timeout has been encountered and is sent, the method won't return until the process has completely exited
  3. Note that if the child process intercepts and handles the signal and doesn't exit, the parent process will wait until the child process has exited.
  4. If the process times out or has a non-zero exit code, this method will throw.
  5. The object will contain the entire result from
  6. Pid of the child process.
  7. Array of results from stdio output.
  8. The contents of
  9. The exit code of the child process.
  10. The signal used to kill the child process.
  11. The error object if the child process failed or timed out.
  12. The method is generally identical to with the exception that the function will not return until the child process has fully closed.
  13. Instances of the class are that represent spawned child processes.
  14. Instances of are not intended to be created directly.
  15. Rather, use the or methods to create instances of
  16. The exit code if the child exited on its own.
  17. The signal by which the child process was terminated.
  18. The event is emitted when the stdio streams of a child process have been closed.
  19. This is distinct from the event, since multiple processes might share the same stdio streams.
  20. The event is emitted after calling the method in parent process or in child process.
  21. After disconnecting it is no longer possible to send or receive messages, and the property is
  22. The error
  23. The event is emitted whenever:
  24. The process could not be spawned, or
  25. The process could not be killed, or
  26. Sending a message to the child process failed.
  27. The event may or may not fire after an error has occurred.
  28. When listening to both the and events, it is important to guard against accidentally invoking handler functions multiple times.
  29. See also and
  30. The event is emitted after the child process ends.
  31. If the process exited, is the final exit code of the process, otherwise
  32. If the process terminated due to receipt of a signal, is the string name of the signal, otherwise
  33. One of the two will always be non-null.
  34. Note that when the event is triggered, child process stdio streams might still be open.
  35. Also, note that Node.js establishes signal handlers for and and Node.js processes will not terminate immediately due to receipt of those signals.
  36. Rather, Node.js will perform a sequence of cleanup actions and then will re-raise the handled signal.
  37. A parsed JSON object or primitive value.
  38. A or object, or undefined.
  39. The event is triggered when a child process uses to send messages.
  40. The message goes through serialization and parsing.
  41. The resulting message might not be the same as what is originally sent.
  42. A pipe representing the IPC channel to the child process.
  43. The property is a reference to the child's IPC channel.
  44. If no IPC channel currently exists, this property is
  45. Set to after is called.
  46. The property indicates whether it is still possible to send and receive messages from a child process.
  47. When is it is no longer possible to send or receive messages.
  48. Closes the IPC channel between parent and child, allowing the child to exit gracefully once there are no other connections keeping it alive.
  49. After calling this method the and properties in both the parent and child (respectively) will be set to, and it will be no longer possible to pass messages between the processes.
  50. The event will be emitted when there are no messages in the process of being received.
  51. This will most often be triggered immediately after calling
  52. Note that when the child process is a Node.js instance (e.g. spawned using) the method can be invoked within the child process to close the IPC channel as well.
  53. The method sends a signal to the child process.
  54. If no argument is given, the process will be sent the signal.
  55. See for a list of available signals.
  56. Send to process
  57. The object may emit an event if the signal cannot be delivered.
  58. Sending a signal to a child process that has already exited is not an error but may have unforeseen consequences.
  59. Specifically, if the process identifier (PID) has been reassigned to another process, the signal will be delivered to that process instead which can have unexpected results.
  60. Note that while the function is called, the signal delivered to the child process may not actually terminate the process.
  61. See for reference.
  62. Also note: on Linux, child processes of child processes will not be terminated when attempting to kill their parent.
  63. This is likely to happen when running a new process in a shell or with use of the option of, such as in this example:
  64. does not terminate the node process in the shell
  65. Set to after is used to successfully send a signal to the child process.
  66. The property indicates whether the child process successfully received a signal from
  67. The property does not indicate that the child process has been terminated.
  68. Returns the process identifier (PID) of the child process.
  69. The argument, if present, is an object used to parameterize the sending of certain types of handles.
  70. supports the following properties:
  71. A value that can be used when passing instances of
  72. When, the socket is kept open in the sending process.
  73. When an IPC channel has been established between the parent and child (i.e. when using), the method can be used to send messages to the child process.
  74. When the child process is a Node.js instance, these messages can be received via the event.
  75. For example, in the parent script:
  76. Causes the child to print:
  77. And then the child script, might look like this:
  78. Child Node.js processes will have a method of their own that allows the child to send messages back to the parent.
  79. There is a special case when sending a message.
  80. Messages containing a prefix in the property are reserved for use within Node.js core and will not be emitted in the child's event.
  81. Rather, such messages are emitted using the event and are consumed internally by Node.js.
  82. Applications should avoid using such messages or listening for events as it is subject to change without notice.
  83. The optional argument that may be passed to is for passing a TCP server or socket object to the child process.
  84. The child will receive the object as the second argument passed to the callback function registered on the event.
  85. Any data that is received and buffered in the socket will not be sent to the child.
  86. The optional is a function that is invoked after the message is sent but before the child may have received it.
  87. The function is called with a single argument: on success, or an object on failure.
  88. If no function is provided and the message cannot be sent, an event will be emitted by the object.
  89. This can happen, for instance, when the child process has already exited. will return if the channel has closed or when the backlog of unsent messages exceeds a threshold that makes it unwise to send more.
  90. Otherwise, the method returns
  91. The function can be used to implement flow control.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement