This reported in the gnuplot-info list.
http://gnuplot.10905.n7.nabble.com/How-to-ignore-quot-popen-failed-quot-td20802.html
If one execute below in the directory where no *.dat
gnuplot> flist=system("dir /B *.dat") popen failed
This does not happens on gnuplot.exe and wgnuplot_pipes.exe.
Is this a bug of wgnuplot ? Is this a side effect of fake pipe?
At present working directory where test.txt exist but not no *.dat files.
For gnuplot.exe and wgnuplot_pipes.exe
For wgnuplot.exe
On wgnuplot.exe, pipe emulation is used (fake_popen, fake_pclose).
In fakepoen system (_wsystem) function is used.
system function returns 1 when no matching file exists.
(Tested below code)
Results
popen (fake_popen) is NULL and then message "popen failed" apear.
This behaivor does not match with those in gnuplot.exe and wgnuplot_pipes.exe
and it may be fixed.
Last edit: Tatsuro MATSUOKA 2017-07-29
This is a bug or shortcoming of the "fake" pipe emulation. If the command interpreter cannot execute a command, it returns 1. Currently gnuplot interprets this return value as such and fails. Of course 1 can also be a valid return code by a (more-or-less) successful command, which is the case here. A simple work-around is to force a return value of zero:
Interestingly, VC and Mingw64 now have their own working implementations of popen/pclose for GUI applications. So we now use them instead of our own emulation.
Fixed in CVS for 5.3, but should be applied to 5.2 and 5.0 after testing, too.
I have confirmed the fix in CVS. Thanks!
Although it now works in practice with VS2015 and Mingw64, MSDN claims otherwise. Below's a quote from the
_popen / _wpopen
documentation, see https://msdn.microsoft.com/en-us/library/96ayss4b.aspx :I suppose this has been fixed in recent versions of VC, but documentation hasn't changed yet. So a version check might be in order here.
Tatsuro, do you know which version of VC Kakuto uses for his builds? I vaguely remember that we tried to keep config/msvc/Makfile compliant with VS2010....
I once heard which version of MSVC Kakuto used but I cannot remember the version. OK I will ask him.
I found the version information in his web site (written in Japanese). He is using Visual Studio 2010.
I have recieved a reply from Kakuto. New _wpopen() works on wgnuplot.exe on his build environments.
I have also downloaded his binary from http://ctan.ijs.si/mirror/w32tex/w32/ and confirmed that new pipe works on his wgnuplot.
Thanks, Tatsuro! I too have tested Kakuto's binary, and pipe support seems to work as intended. Changes now applied to 5.0 and 5.2, too.