From: Jean-Marc Lasgouttes Date: Fri, 8 Feb 2002 11:23:58 +0000 (+0000) Subject: fix do_popen for cygwin X-Git-Tag: 1.6.10~19885 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c42c666fdc009fb18ce7bdb9f93c39b5c5c43dab;p=features.git fix do_popen for cygwin git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3510 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/ChangeLog b/src/support/ChangeLog index f81d1cc6ff..70ec20926e 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,10 +1,15 @@ +2002-02-08 Jean-Marc Lasgouttes + + * filetools.C (do_popen): fix for cygwin compatibility (from Claus + Hentschel). This code should maybe be moved to os:: class. + 2002-02-08 Herbert Voss - * filetools.[C]: (unzipFile) fix typo + * filetools.C: (unzipFile) fix typo 2002-02-06 Herbert Voss - * filetools.[Ch]: fix sume bugs for detecting zipped files + * filetools.[Ch]: fix some bugs for detecting zipped files adding unzipFile() 2002-02-04 Herbert Voss diff --git a/src/support/filetools.C b/src/support/filetools.C index 515e2ea8e1..37aab49fc7 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -1134,7 +1134,18 @@ cmdret const do_popen(string const & cmd) // of course the best would be to have a // pstream (process stream), with the // variants ipstream, opstream - FILE * inf = ::popen(cmd.c_str(), "r"); + + // CYGWIN needs 'b', but linux only works without it +#ifdef __CYGWIN__ + FILE * inf = ::popen(cmd.c_str(), "rb"); +#else + FILE * inf = ::popen(cmd.c_str(), "r"); +#endif + + // (Claus Hentschel) Check if popen was succesful ;-) + if (!inf) + return make_pair(-1, string()); + string ret; int c = fgetc(inf); while (c != EOF) {