~d-ci/libmemcached/pushtest

« back to all changes in this revision

Viewing changes to libtest/cmdline.cc

  • Committer: Continuous Integration
  • Date: 2013-01-28 22:54:43 UTC
  • mfrom: (1098.1.1 1.2)
  • Revision ID: ci@tangent.org-20130128225443-acu5o9wpr5nhjqob
Merge lp:~tangent-org/libmemcached/1.2-build/ Build: jenkins-Libmemcached-217

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
    {
139
139
      if (libtool() == NULL)
140
140
      {
141
 
        fatal_message("libtool requested, but know libtool was found");
 
141
        FATAL("libtool requested, but know libtool was found");
142
142
      }
143
143
    }
144
144
 
366
366
 
367
367
    case EFAULT:
368
368
    case ENOMEM:
369
 
      fatal_message(strerror(error));
 
369
      FATAL(strerror(error));
370
370
      break;
371
371
 
372
372
    case EINVAL:
373
 
      fatal_message("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid");
 
373
      FATAL("RLIMIT_NOFILE exceeded, or if OSX the timeout value was invalid");
374
374
      break;
375
375
 
376
376
    default:
377
 
      fatal_message(strerror(error));
 
377
      FATAL(strerror(error));
378
378
      break;
379
379
    }
380
380
 
409
409
Application::error_t Application::join()
410
410
{
411
411
  pid_t waited_pid= waitpid(_pid, &_status, 0);
 
412
  slurp();
412
413
  if (waited_pid == _pid and WIFEXITED(_status) == false)
413
414
  {
 
415
 
414
416
    /*
415
417
      What we are looking for here is how the exit status happened.
416
418
      - 127 means that posix_spawn() itself had an error.
423
425
      std::string error_string("posix_spawn() failed pid:");
424
426
      error_string+= _pid;
425
427
      error_string+= " name:";
426
 
      error_string+= built_argv[0];
 
428
      error_string+= print_argv(built_argv);
 
429
      if (stderr_result_length())
 
430
      {
 
431
        error_string+= " stderr: ";
 
432
        error_string+= stderr_c_str();
 
433
      }
427
434
      throw std::logic_error(error_string);
428
435
    }
429
436
    else if (WIFSIGNALED(_status))
431
438
      if (WTERMSIG(_status) != SIGTERM and WTERMSIG(_status) != SIGHUP)
432
439
      {
433
440
        _app_exit_state= Application::INVALID_POSIX_SPAWN;
434
 
        std::string error_string(built_argv[0]);
 
441
        std::string error_string(print_argv(built_argv));
435
442
        error_string+= " was killed by signal ";
436
443
        error_string+= strsignal(WTERMSIG(_status));
 
444
        if (stdout_result_length())
 
445
        {
 
446
          error_string+= " stdout: ";
 
447
          error_string+= stdout_c_str();
 
448
        }
 
449
        if (stderr_result_length())
 
450
        {
 
451
          error_string+= " stderr: ";
 
452
          error_string+= stderr_c_str();
 
453
        }
 
454
 
437
455
        throw std::runtime_error(error_string);
438
456
      }
439
457
 
589
607
  if (pipe(_pipe_fd) == -1)
590
608
#endif
591
609
  {
592
 
    fatal_message(strerror(errno));
 
610
    FATAL(strerror(errno));
593
611
  }
594
612
  _open[0]= true;
595
613
  _open[1]= true;
596
614
 
597
615
#if defined(HAVE_PIPE2) && HAVE_PIPE2
598
 
  return;
599
 
#endif
600
616
  {
601
617
    nonblock();
602
618
    cloexec();
603
619
  }
 
620
#endif
604
621
}
605
622
 
606
623
void Application::Pipe::cloexec()
656
673
  int ret;
657
674
  if ((ret= posix_spawn_file_actions_adddup2(&file_actions, _pipe_fd[type], _std_fd )) < 0)
658
675
  {
659
 
    Error << "posix_spawn_file_actions_adddup2(" << strerror(ret) << ")";
660
 
    fatal_message(strerror(ret));
 
676
    FATAL("posix_spawn_file_actions_adddup2(%s)", strerror(ret));
661
677
  }
662
678
 
663
679
  if ((ret= posix_spawn_file_actions_addclose(&file_actions, _pipe_fd[type])) < 0)
664
680
  {
665
 
    Error << "posix_spawn_file_actions_adddup2(" << strerror(ret) << ")";
666
 
    fatal_message(strerror(ret));
 
681
    FATAL("posix_spawn_file_actions_addclose(%s)", strerror(ret));
667
682
  }
668
683
}
669
684