Example #1
0
  void operator () (const value_type & value)
  {
    CUTS_Process_Options opts;

    // Initialize the process options.
    opts.name_ = value->id ().c_str ();
    opts.exec_ = value->executable ().c_str ();

    if (value->arguments_p ())
      opts.args_  = value->arguments ().c_str ();

    if (value->workingdirectory_p ())
      opts.cwd_ = value->workingdirectory ().c_str ();

    if (value->delay_p ())
      opts.delay_.set (value->delay ());

    if (value->waitforcompletion_p ())
      opts.wait_for_completion_ = value->waitforcompletion ();

    if (value->output_p ())
      opts.stdout_ = value->output ().c_str ();

    if (value->error_p ())
      opts.stderr_ = value->error ().c_str ();

    // Install the process into the environment.
    int retval;

    if (this->startup_)
      retval = this->env_.startup_list ().append (opts);
    else
      retval = this->env_.shutdown_list ().append (opts);

    if (0 != retval)
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("%T (%t) - %M - failed to add %s to %s process list\n"),
                  opts.name_.c_str (),
                  this->startup_ ? ACE_TEXT ("startup") : ACE_TEXT ("shutdown")));
  }