pcntl_wait.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --TEST--
  2. pcntl_wait()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("pcntl")) print "skip"; ?>
  5. <?php if (!extension_loaded("posix")) die("skip posix extension not available"); ?>
  6. --FILE--
  7. <?php
  8. $pid = pcntl_fork();
  9. if ($pid == 1) {
  10. die("failed");
  11. } else if ($pid) {
  12. $status = 0;
  13. pcntl_wait($status, WUNTRACED);
  14. var_dump(pcntl_wifexited($status));
  15. posix_kill($pid, SIGCONT);
  16. pcntl_wait($status);
  17. var_dump(pcntl_wifsignaled($status));
  18. var_dump(pcntl_wifstopped($status));
  19. var_dump(pcntl_wexitstatus($status));
  20. var_dump(pcntl_wait($status, WNOHANG | WUNTRACED));
  21. var_dump(pcntl_wait());
  22. var_dump(pcntl_waitpid());
  23. var_dump(pcntl_wifexited());
  24. var_dump(pcntl_wifstopped());
  25. var_dump(pcntl_wifsignaled());
  26. var_dump(pcntl_wexitstatus());
  27. var_dump(pcntl_wtermsig());
  28. var_dump(pcntl_wstopsig());
  29. } else {
  30. posix_kill(posix_getpid(), SIGSTOP);
  31. exit(42);
  32. }
  33. ?>
  34. --EXPECTF--
  35. bool(false)
  36. bool(false)
  37. bool(false)
  38. int(42)
  39. int(-1)
  40. Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s
  41. NULL
  42. Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s
  43. NULL
  44. Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s
  45. NULL
  46. Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s
  47. NULL
  48. Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s
  49. NULL
  50. Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s
  51. NULL
  52. Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s
  53. NULL
  54. Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s
  55. NULL