#25727 [Opn->Fbk]: popen returns wrong exitcode

From: Date: Thu, 02 Oct 2003 23:31:25 +0000
Subject: #25727 [Opn->Fbk]: popen returns wrong exitcode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-48471@lists.php.net to get a copy of this message
ID: 25727 Updated by: iliaa@php.net Reported By: eru@php.net -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: i386 Linux PHP Version: 4CVS-2003-10-02 (stable) New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip I too (like sniper) get the correct output int(0) Previous Comments: ------------------------------------------------------------------------ [2003-10-02 10:45:08] sniper@php.net For me the output is (when replaced fread with fgets) this: FOO int(0) ------------------------------------------------------------------------ [2003-10-02 09:12:04] eru@php.net I always questions "suggestions" given without explanation and I will continue to do so in the future. Now that you've given me one I can assure you that the outcome is just the same. Please note, that I tested this snippet on at least 4 different systems with different accounts and got the behaviours described in expected/actual result. ------------------------------------------------------------------------ [2003-10-02 09:00:17] wez@php.net If you pclose before all the data has been read, you might cause the child process to terminate abnormally, and this might explain the exit code. In addition, fread() will only read a "packet" from a pipe, so you might not be getting all the data before you pclose it. *that's* what fread/fgets() has got to do with it; in future, please don't question my suggestions and just provide the requested feedback. ------------------------------------------------------------------------ [2003-10-02 08:38:42] eru@php.net What has the fread/fgets to do with the problem? I'm talking about the exitcode here. The fread-line is just a demonstration, that the command is carried out correctly. ------------------------------------------------------------------------ [2003-10-02 08:20:43] wez@php.net Try using fgets() ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25727 -- Edit this bug report at http://bugs.php.net/?id=25727&edit=1

« previous php.bugs (#48471) next »