We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 763deb4 commit 717a4f6Copy full SHA for 717a4f6
ext/standard/tests/misc/shell_exec_variation.phpt
@@ -0,0 +1,27 @@
1
+--TEST--
2
+shell_exec() with exit code setting
3
+--SKIPIF--
4
+<?php
5
+if (!is_executable("/bin/true")) echo "skip";
6
+if (!function_exists("shell_exec")) echo "skip shell_exec() is not available";
7
+?>
8
+--FILE--
9
10
+$retcode = null;
11
+
12
+$commands = [
13
+ "/bin/true",
14
+ "non-existent-command > /dev/null 2>&1"
15
+];
16
17
+foreach ($commands as $command) {
18
+ shell_exec($command, $retcode);
19
+ var_dump($retcode);
20
+}
21
22
+echo "Done\n";
23
24
+--EXPECT--
25
+int(0)
26
+int(127)
27
+Done
0 commit comments