We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 115545e commit e9f686aCopy full SHA for e9f686a
1 file changed
php/tests/smoke.php
@@ -8,8 +8,29 @@
8
$secret = getenv('CODE_BRIDGE_SECRET') ?: 'dev-secret';
9
10
$client = new Client(new BridgeConfig($url, $secret, 'php-test'));
11
-$client->start();
12
$client->sendConsole('smoke test console');
13
$client->sendError('smoke test error');
14
-$client->stop();
+
+if (!function_exists('pcntl_fork')) {
15
+ echo "pcntl not available; skipping php smoke\n";
16
+ exit(0);
17
+}
18
19
+$pid = pcntl_fork();
20
+if ($pid === -1) {
21
+ fwrite(STDERR, "fork failed\n");
22
+ exit(1);
23
24
25
+if ($pid === 0) {
26
+ pcntl_async_signals(true);
27
+ pcntl_signal(SIGALRM, function () use ($client) {
28
+ $client->stop();
29
+ });
30
+ pcntl_alarm(4);
31
+ $client->start();
32
33
34
35
+pcntl_waitpid($pid, $status);
36
echo "php smoke ok\n";
0 commit comments