Plugin Helper: Child Process
The child_process
helper manages the child processes' lifecycle.
Here is an example:
The launched child process is managed by the plugin helper which automatically shutdown
s it.
Methods
child_process_execute(title, sub_process_name, arguments: nil, subprocess_name: nil, interval: nil, immediate: false, parallel: false, mode: [:read, :write], stderr: :discard, env: {}, unsetenv: false, chdir: nil, internal_encoding: 'utf-8', external_encoding: 'ascii-8bit', scrub: true, replace_string: nil, wait_timeout: nil, on_exit_callback: nil, &block)
child_process_execute(title, sub_process_name, arguments: nil, subprocess_name: nil, interval: nil, immediate: false, parallel: false, mode: [:read, :write], stderr: :discard, env: {}, unsetenv: false, chdir: nil, internal_encoding: 'utf-8', external_encoding: 'ascii-8bit', scrub: true, replace_string: nil, wait_timeout: nil, on_exit_callback: nil, &block)
This method executes child_process
with the given parameters and routine.
title
: unique symbol valuesub_process_name
: sub process name valueinterval
: Second unitinteger
/float
value.immediate
:true
/false
. Default isfalse
.parallel
:true
/false
. Default isfalse
.mode
: [:read
,:write
]. Default is [:read
,:write
].stderr
: Connect stderr or not. Default is:discard
.env
: Environment valuables. Default is {}.unsetenv
:true
/false
. Default isfalse
chdir
: Working directory. Default isnil
.internal_encoding
: Internal character encoding. Default isutf-8
.external_encoding
: External character encoding. Default isascii-8bit
'scrub
:true
/false
. Default istrue
.replace_string
: Replace the invalid code point with the specified character.Default is
nil
.wait_timeout
: Set timeout seconds. Default isnil
.on_exit_callback
: Set callback function. Default isnil
Code examples:
Plugins using child_process
child_process
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last updated