lib/mongo/crypt/encryption_io.rb
# Spawn a new mongocryptd process using the mongocryptd_spawn_path
# and mongocryptd_spawn_args passed in through the extra auto
# encrypt options. Stdout and Stderr of this new process are written
# to /dev/null.
#
# @note To capture the mongocryptd logs, add "--logpath=/path/to/logs"
#   to auto_encryption_options -> extra_options -> mongocrpytd_spawn_args
#
# @return [ Integer ] The process id of the spawned process
#
# @raise [ ArgumentError ] Raises an exception if no encryption options
#   have been provided
Spawn a new mongocryptd process using the mongocryptd_spawn_path
and mongocryptd_spawn_args passed in through the extra auto
encrypt options. Stdout and Stderr of this new process are written
to /dev/null.
Spawn a new mongocryptd process using the mongocryptd_spawn_path and mongocryptd_spawn_args passed in through the extra auto encrypt options . Stdout and Stderr of this new process are written to / dev / null .
def spawn_mongocryptd
        mongocryptd_spawn_args = @options[:mongocryptd_spawn_args]
        mongocryptd_spawn_path = @options[:mongocryptd_spawn_path]
        unless mongocryptd_spawn_path
          raise ArgumentError.new(
            'Cannot spawn mongocryptd process when no ' +
            ':mongocryptd_spawn_path option is provided'
          )
        end
        if mongocryptd_spawn_path.nil? ||
          mongocryptd_spawn_args.nil? || mongocryptd_spawn_args.empty?
        then
          raise ArgumentError.new(
            'Cannot spawn mongocryptd process when no :mongocryptd_spawn_args ' +
            'option is provided. To start mongocryptd without arguments, pass ' +
            '"--" for :mongocryptd_spawn_args'
          )
        end
        begin
          Process.spawn(
            mongocryptd_spawn_path,
            *mongocryptd_spawn_args,
            [:out, :err]=>'/dev/null'
          )
        rescue Errno::ENOENT => e
          raise Error::MongocryptdSpawnError.new(
            "Failed to spawn mongocryptd at the path \"#{mongocryptd_spawn_path}\" " +
            "with arguments #{mongocryptd_spawn_args}. Received error " +
            "#{e.class}: \"#{e.message}\""
          )
        end
      end
def spawn_mongocryptd mongocryptd_spawn_args = @options [ :mongocryptd_spawn_args ] mongocryptd_spawn_path = @options [ :mongocryptd_spawn_path ] unless mongocryptd_spawn_path raise ArgumentError . new ( 'Cannot spawn mongocryptd process when no ' + ':mongocryptd_spawn_path option is provided' ) end if mongocryptd_spawn_path . nil? || mongocryptd_spawn_args . nil? || mongocryptd_spawn_args . empty? then raise ArgumentError . new ( 'Cannot spawn mongocryptd process when no :mongocryptd_spawn_args ' + 'option is provided. To start mongocryptd without arguments, pass ' + '"--" for :mongocryptd_spawn_args' ) end begin Process . spawn ( mongocryptd_spawn_path , * mongocryptd_spawn_args , [ :out , :err ] => '/dev/null' ) rescue Errno :: ENOENT => e raise Error :: MongocryptdSpawnError . new ( "Failed to spawn mongocryptd at the path \"#{mongocryptd_spawn_path}\" " + "with arguments #{mongocryptd_spawn_args}. Received error " + "#{e.class}: \"#{e.message}\"" ) end end
Spawn a new mongocryptd process using the mongocryptd_spawn_path
and mongocryptd_spawn_args passed in through the extra auto
encrypt options.
Spawn a new mongocryptd process using the mongocryptd_spawn_path and mongocryptd_spawn_args passed in through the extra auto encrypt options .
The process id of the spawned process
The process id of the spawned process
 Integer 
[ ArgumentError ] Raises an exception if no encryption options have been provided
[ ArgumentError ] Raises an exception if no encryption options have been provided
note
To capture the mongocryptd logs, add "--logpath=/path/to/logs" to auto_encryption_options -> extra_options -> mongocrpytd_spawn_args
To capture the mongocryptd logs add " -- logpath = / path / to / logs " to auto_encryption_options - > extra_options - > mongocrpytd_spawn_args