kenmozi / php-serial

Automatically exported from code.google.com/p/php-serial
0 stars 0 forks source link

stty --version check fails with Busybox #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The test for stty is not working if we use Busybox. That one doesn't have a 
--version parameter. The solution is to check if the program is available 
without directly calling it. The following patch is working for me:

<pre>
--- php_serial.class.php.orig
+++ php_serial.class.php
@@ -49,7 +49,7 @@
        {
            $this->_os = "linux";

-           if($this->_exec("stty --version") === 0)
+           if($this->_exec("which stty", $output) === 0)
            {
                register_shutdown_function(array($this, "deviceClose"));
            }
</pre>

Original issue reported on code.google.com by hvdka...@gmail.com on 4 Oct 2012 at 11:36

GoogleCodeExporter commented 8 years ago
Forget the $output. That was used in my debugging :). The correct patch is as 
follow:

<pre>
--- php_serial.class.php.orig
+++ php_serial.class.php
@@ -49,7 +49,7 @@
        {
            $this->_os = "linux";

-           if($this->_exec("stty --version") === 0)
+           if($this->_exec("which stty") === 0)
            {
                register_shutdown_function(array($this, "deviceClose"));
            }
</pre>

Original comment by hvdka...@gmail.com on 4 Oct 2012 at 11:40