Advertisement
robertbira

Italian Translation Report: Node.js [Part 35 - 1145 words]

Sep 18th, 2018
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. The command to run.
  2. List of string arguments.
  3. Current working directory of the child process.
  4. Environment key-value pairs.
  5. Explicitly set the value of sent to the child process.
  6. This will be set to if not specified.
  7. Child's stdio configuration (see)
  8. Prepare child to run independently of its parent process.
  9. Specific behavior depends on the platform, see
  10. Sets the user identity of the process (see)
  11. Sets the group identity of the process (see)
  12. If, runs inside of a shell.
  13. A different shell can be specified as a string.
  14. No quoting or escaping of arguments is done on Windows.
  15. This is set to automatically when is specified.
  16. The method spawns a new process using the given, with command line arguments in
  17. If omitted, defaults to an empty array.
  18. A third argument may be used to specify additional options, with these defaults:
  19. Use to specify the working directory from which the process is spawned.
  20. If not given, the default is to inherit the current working directory.
  21. Use to specify environment variables that will be visible to the new process, the default is
  22. values in will be ignored.
  23. Example of running capturing and the exit code:
  24. Example: A very elaborate way to run
  25. Example of checking for failed
  26. Certain platforms (macOS, Linux) will use the value of for the process title while others (Windows, SunOS) will use
  27. Node.js currently overwrites with on startup, so in a Node.js child process will not match the parameter passed to from the parent, retrieve it with the property instead.
  28. On Windows, setting to makes it possible for the child process to continue running after the parent exits.
  29. The child will have its own console window.
  30. Once enabled for a child process, it cannot be disabled
  31. On non-Windows platforms, if is set to, the child process will be made the leader of a new process group and session.
  32. Note that child processes may continue running after the parent exits regardless of whether they are detached or not.
  33. See for more information.
  34. By default, the parent will wait for the detached child to exit.
  35. To prevent the parent from waiting for a given, use the method.
  36. Doing so will cause the parent's event loop to not include the child in its reference count, allowing the parent to exit independently of the child, unless there is an established IPC channel between the child and parent.
  37. When using the option to start a long-running process, the process will not stay running in the background after the parent exits unless it is provided with a configuration that is not connected to the parent.
  38. If the parent's is inherited, the child will remain attached to the controlling terminal.
  39. Example of a long-running process, by detaching and also ignoring its parent file descriptors, in order to ignore the parent's termination:
  40. Alternatively one can redirect the child process' output into files:
  41. The option is used to configure the pipes that are established between the parent and child process.
  42. By default, the child's and are redirected to corresponding, and streams on the object.
  43. This is equivalent to setting the equal to
  44. For convenience, may be one of the following strings:
  45. equivalent to (the default)
  46. Otherwise, the value of is an array where each index corresponds to an fd in the child.
  47. The fds 0, 1, and 2 correspond to and, respectively.
  48. Additional fds can be specified to create additional pipes between the parent and child
  49. The value is one of the following:
  50. Create a pipe between the child process and the parent process
  51. The parent end of the pipe is exposed to the parent as a property on the object as
  52. Pipes creates for fds 0 - 2 are also available as and respectively.
  53. Create an IPC channel for passing messages/file descriptors between parent and child.
  54. A may have at most one IPC file descriptor
  55. Setting this option enables the method.
  56. If the child is a Node.js process, the presence of an IPC channel will enable and methods, as well as events within the child.
  57. Accessing the IPC channel fd in any way other than or using the IPC channel with a child process that is not a Node.js instance is not supported.
  58. Instructs Node.js to ignore the fd in the child.
  59. While Node.js will always open fds 0 - 2 for the processes it spawns, setting the fd to will cause Node.js to open and attach it to the child's fd.
  60. Share a readable or writable stream that refers to a tty, file, socket, or a pipe with the child process.
  61. The stream's underlying file descriptor is duplicated in the child process to the fd that corresponds to the index in the array.
  62. Note that the stream must have an underlying descriptor (file streams do not until the event has occurred).
  63. The integer value is interpreted as a file descriptor that is currently open in the parent process.
  64. It is shared with the child process, similar to how objects can be shared.
  65. Use default value.
  66. For fds 0, 1, and 2 (in other words, and) a pipe is created.
  67. For fd 3 and up, the default is
  68. Child will use parent's
  69. Spawn child sharing only
  70. Open an extra fd=4, to interact with programs presenting a startd-style interface.
  71. It is worth noting that when an IPC channel is established between the parent and child processes, and the child is a Node.js process, the child is launched with the IPC channel unreferenced (using) until the child registers an event handler for the event or the event.
  72. This allows the child to exit normally without the process being held open by the open IPC channel.
  73. Synchronous Process Creation
  74. The and methods are synchronous and WILL block the Node.js event loop, pausing execution of any additional code until the spawned process exits.
  75. Blocking calls like these are mostly useful for simplifying general-purpose scripting tasks and for simplifying the loading/processing of application configuration at startup.
  76. The value which will be passed as to the spawned process.
  77. Supplying this value will override
  78. Child's configuration.
  79. by default will be output to the parent process' unless is specified.
  80. In milliseconds the maximum amount of time the process is allowed to run.
  81. The signal value to be used when the spawned process will be killed.
  82. The encoding used for all stdio inputs and outputs.
  83. The stdout from the command.
  84. The method is generally identical to with the exception that the method will not return until the child process has fully closed.
  85. When a timeout has been encountered and is sent, the method won't return until the process has completely exited.
  86. If the child process intercepts and handles the signal and does not exit, the parent process will still wait until the child process has exited.
  87. If the process times out or has a non-zero exit code, this method will throw an that will include the full result of the underlying
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement