Topic: Improvement for STL: exec-stream
Author: wm2015email@gmail.com
Date: Sun, 18 Dec 2016 03:57:38 -0800 (PST)
Raw View
------=_Part_177_1313647104.1482062258044
Content-Type: multipart/alternative;
boundary="----=_Part_178_1462585893.1482062258045"
------=_Part_178_1462585893.1482062258045
Content-Type: text/plain; charset=UTF-8
Lib Exec Stream. looks useful and simple:
http://libexecstream.sourceforge.net/
Why not add it to the STL?
The libexecstream library
Overview <http://libexecstream.sourceforge.net/#overview>
Download <http://libexecstream.sourceforge.net/#download>
Installation <http://libexecstream.sourceforge.net/#installation>
Reference <http://libexecstream.sourceforge.net/reference.html>
News <http://libexecstream.sourceforge.net/news.html>
License <http://libexecstream.sourceforge.net/license.html>
[image: SourceForge.net Logo] <http://sourceforge.net>
Overview
Libexecstream is a C++ library that allows you to run a child process and
have its input, output and error avaliable as standard C++ streams.
Like this:
#include <exec-stream.h>
#include <string>
....
try {
exec_stream_t es <http://libexecstream.sourceforge.net/reference.html#constructor1>( "perl", "" ); // run perl without any arguments
es.in <http://libexecstream.sourceforge.net/reference.html#in>() << "print \"hello world\";"; // and make it print "hello world"
es.close_in <http://libexecstream.sourceforge.net/reference.html#close_in>(); // after the input was closed
std::string hello, world;
es.out <http://libexecstream.sourceforge.net/reference.html#out>() >> hello; // read the first word of output
es.out <http://libexecstream.sourceforge.net/reference.html#out>() >> world; // read the second word
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << "\n";
}
Features:
- Works on Linux and Windows
- Uses threads
- Does not depend on any other non-standard library
- Distributed as source code only, requires you to compile and link one
file into your program
- BSD-style license <http://libexecstream.sourceforge.net/license.html>
Another example:
#include <exec-stream.h>
....
exec_stream_t es <http://libexecstream.sourceforge.net/reference.html#constructor0>;
try {
// run command to print network configuration, depending on the operating system
#ifdef _WIN32
es.start <http://libexecstream.sourceforge.net/reference.html#start1>( "ipconfig", "/all" );
#else
es.start <http://libexecstream.sourceforge.net/reference.html#start1>( "ifconfig", "-a" );
#endif
std::string s;
while( std::getline( es.out <http://libexecstream.sourceforge.net/reference.html#out>(), s ).good() ) {
// do something with s
}
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << "\n";
}
For more examples see the file test/exec-stream-test.cpp in the source
distribution. The interface provided by the library is documented in the
reference <http://libexecstream.sourceforge.net/reference.html>.
Download
Latest source release from SourceForge: follow this link
<http://sourceforge.net/project/showfiles.php?group_id=103810&package_id=111533&release_id=230408>
for downloading libexecstream-0.3.tar.gz
Get source from the CVS:
(password is empty) cvs
-d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream co
libexecstream
View source in the CVS: http://cvs.sourceforge.net/viewcvs.py/libexecstream
Link to the SourceForge project page:
http://sourceforge.net/projects/libexecstream/ Installation
Libexecstream is provided in source code form only. In order to use it, you
need to compile and link one file, exec-stream.cpp, into your program.
On Linux, libexecstream was tested on Red Hat 9 with gcc compiler. Versions
of gcc prior to 3.0 will not work. Make sure that exec-stream.h is found
somewhere on the include path, compile exec-stream.cpp as usual, link your
program with -lpthread. GCC must be configured with --enable-threads, which
is by default on most Linux distributions.
On Windows, libexecstream was tested on XP and 95 flavors with VC++ 7
compiler. VC++ 6 will not work. Make sure that exec-stream.h is found
somewhere on the include path, compile exec-stream.cpp as usual, link you
program with multi-threaded runtime.
Example makefiles for Windows and Linux (used to build the testsute) are
provided in the test directory of the source distribution.
The exec-stream.cpp file includes several platform-dependent implementation
files. Selection of platform-specific implementation is done at compile
time: when _WIN32 macro is defined (usually by windows compiler) win32
implementation is included, when that macro is not defined, posix
implementation is included.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/63c73c9f-3276-4fb1-87d0-ddbcc7b4440e%40isocpp.org.
------=_Part_178_1462585893.1482062258045
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Lib Exec Stream.=C2=A0 looks useful and simple:<br><br>htt=
p://libexecstream.sourceforge.net/<br><br><br>Why not add it to the STL?=C2=
=A0 <br><br><h1>The libexecstream library</h1>
<table class=3D"maintable"><colgroup><col class=3D"linksbar">
<col class=3D"body">
</colgroup><tbody><tr>
<td class=3D"linksbar" valign=3D"top">
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/#overview">Overview</a></div>
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/#download">Download</a></div>
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/#installation">Installation</a></div>
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/reference.html">Reference</a></div>
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/news.html">News</a></div>
<div class=3D"linksbar"><a href=3D"http://libexecstream.sourceforg=
e.net/license.html">License</a></div>
<div class=3D"sflogo"><a href=3D"http://sourceforge.net"><img src=
=3D"http://sourceforge.net/sflogo.php?group_id=3D103810&type=3D4" alt=
=3D"SourceForge.net Logo" width=3D"125" height=3D"37" border=3D"0"></a></di=
v>
</td>
<td class=3D"body">
<h2><a name=3D"overview"></a>Overview</h2>
<p>Libexecstream is a C++ library that allows you to run a child process an=
d have its input, output and error
avaliable as standard C++ streams.=20
</p>
<p>Like this:</p>
<pre>#include <exec-stream.h>
#include <string>
....
try {
exec_stream_t <a href=3D"http://libexecstream.sourceforge.net/reference=
..html#constructor1">es</a>( "perl", "" ); <span class=
=3D"comment">// run perl without any arguments </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#in">i=
n</a>() << "print \"hello world\";"; <span class=
=3D"comment">// and make it print "hello world" </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#close=
_in">close_in</a>(); <span class=3D"comment">// afte=
r the input was closed </span>
std::string hello, world;
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#out">=
out</a>() >> hello; <span class=3D"comment">// read the first word of=
output </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#out">=
out</a>() >> world; <span class=3D"comment">// read the second word <=
/span>
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << &=
quot;\n";
}
</pre>
<p>Features:
</p><ul><li>Works on Linux and Windows</li><li>Uses threads</li><li>Does no=
t depend on any other non-standard library</li><li>Distributed as source co=
de only, requires you to compile and link one file into your program</li><l=
i>BSD-style <a href=3D"http://libexecstream.sourceforge.net/license.html">l=
icense</a></li></ul>
<p>Another example:
</p>
<pre>#include <exec-stream.h>
....
exec_stream_t <a href=3D"http://libexecstream.sourceforge.net/reference.htm=
l#constructor0">es</a>;
try {
<span class=3D"comment">// run command to print network configuration, =
depending on the operating system</span>
#ifdef _WIN32
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#s=
tart1">start</a>( "ipconfig", "/all" );
#else
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#s=
tart1">start</a>( "ifconfig", "-a" );
#endif
=20
std::string s;
while( std::getline( es.<a href=3D"http://libexecstream.sourceforge.net=
/reference.html#out">out</a>(), s ).good() ) {
<span class=3D"comment">// do something with <var>s</var></span>
}
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << &=
quot;\n";
}
</pre>
<p>For more examples see the file <var>test/exec-stream-test.cpp</var> in t=
he source distribution.=20
The interface provided by the library is documented in the <a href=3D"http:=
//libexecstream.sourceforge.net/reference.html">reference</a>.
</p>
<h2><a name=3D"download"></a>Download</h2>
<table class=3D"downloadlinks"><tbody><tr><td>
Latest source release from SourceForge:
</td><td>
<a href=3D"http://sourceforge.net/project/showfiles.php?group_id=3D103810&a=
mp;package_id=3D111533&release_id=3D230408">follow this link</a> for do=
wnloading libexecstream-0.3.tar.gz
</td></tr></tbody></table>
<table class=3D"downloadlinks"><tbody><tr><td>
Get source from the CVS:
<br>(password is empty)
</td><td>
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream login=
=20
<br>cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream=
co libexecstream
</td></tr></tbody></table>
<table class=3D"downloadlinks"><tbody><tr><td>
View source in the CVS:
</td><td>
<a href=3D"http://cvs.sourceforge.net/viewcvs.py/libexecstream">http://cvs.=
sourceforge.net/viewcvs.py/libexecstream</a>
</td></tr></tbody></table>
<table class=3D"downloadlinks"><tbody><tr><td>
Link to the SourceForge project page:
</td><td>
<a href=3D"http://sourceforge.net/projects/libexecstream/">http://sourcefor=
ge.net/projects/libexecstream/</a>
</td></tr></tbody></table>
<h2><a name=3D"installation"></a>Installation</h2>
<p>Libexecstream is provided in source code form only. In order to use it, =
you need to compile and link
one file, <var>exec-stream.cpp</var>, into your program.
</p>
<p>On Linux, libexecstream was tested on Red Hat 9 with gcc compiler. Versi=
ons of gcc prior to 3.0 will not work.
Make sure that <var>exec-stream.h</var> is found somewhere on the include p=
ath,=20
compile <var>exec-stream.cpp</var> as usual, link your program with <var>-l=
pthread</var>.
GCC must be configured with <var>--enable-threads</var>, which is by defaul=
t on most Linux distributions.
</p>
<p>On Windows, libexecstream was tested on XP and 95 flavors with VC++ 7 co=
mpiler. VC++ 6 will not work.=20
Make sure that <var>exec-stream.h</var> is found somewhere on the include p=
ath,=20
compile <var>exec-stream.cpp</var> as usual, link you program with multi-th=
readed runtime.
</p>
<p>Example makefiles for Windows and Linux (used to build the testsute) are=
provided in the <var>test</var> directory
of the source distribution.
</p>
<p>The <var>exec-stream.cpp</var> file includes several platform-dependent=
=20
implementation files. Selection of platform-specific implementation is done=
at compile time: when <var>_WIN32</var>
macro is defined (usually by windows compiler) win32 implementation is incl=
uded, when that macro is not defined,
posix implementation is included.
</p></td></tr></tbody></table><br><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/63c73c9f-3276-4fb1-87d0-ddbcc7b4440e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/63c73c9f-3276-4fb1-87d0-ddbcc7b4440e=
%40isocpp.org</a>.<br />
------=_Part_178_1462585893.1482062258045--
------=_Part_177_1313647104.1482062258044--
.
Author: wm2015email@gmail.com
Date: Sun, 18 Dec 2016 03:59:48 -0800 (PST)
Raw View
------=_Part_732_1467615456.1482062388773
Content-Type: multipart/alternative;
boundary="----=_Part_733_1377566033.1482062388774"
------=_Part_733_1377566033.1482062388774
Content-Type: text/plain; charset=UTF-8
only on caveat, that would be nice to fix in this library... its not
really easy to do a getline of both stdout and stderr at the same time..
On Sunday, December 18, 2016 at 6:57:38 AM UTC-5, wm201...@gmail.com wrote:
>
> Lib Exec Stream. looks useful and simple:
>
> http://libexecstream.sourceforge.net/
>
>
> Why not add it to the STL?
>
> The libexecstream library
>
> Overview <http://libexecstream.sourceforge.net/#overview>
> Download <http://libexecstream.sourceforge.net/#download>
> Installation <http://libexecstream.sourceforge.net/#installation>
> Reference <http://libexecstream.sourceforge.net/reference.html>
> News <http://libexecstream.sourceforge.net/news.html>
> License <http://libexecstream.sourceforge.net/license.html>
> [image: SourceForge.net Logo] <http://sourceforge.net>
> Overview
>
> Libexecstream is a C++ library that allows you to run a child process and
> have its input, output and error avaliable as standard C++ streams.
>
> Like this:
>
> #include <exec-stream.h>
> #include <string>
> ...
> try {
> exec_stream_t es <http://libexecstream.sourceforge.net/reference.html#constructor1>( "perl", "" ); // run perl without any arguments
> es.in <http://libexecstream.sourceforge.net/reference.html#in>() << "print \"hello world\";"; // and make it print "hello world"
> es.close_in <http://libexecstream.sourceforge.net/reference.html#close_in>(); // after the input was closed
> std::string hello, world;
> es.out <http://libexecstream.sourceforge.net/reference.html#out>() >> hello; // read the first word of output
> es.out <http://libexecstream.sourceforge.net/reference.html#out>() >> world; // read the second word
> }catch( std::exception const & e ) {
> std::cerr << "error: " << e.what() << "\n";
> }
>
> Features:
>
> - Works on Linux and Windows
> - Uses threads
> - Does not depend on any other non-standard library
> - Distributed as source code only, requires you to compile and link
> one file into your program
> - BSD-style license <http://libexecstream.sourceforge.net/license.html>
>
> Another example:
>
> #include <exec-stream.h>
> ...
> exec_stream_t es <http://libexecstream.sourceforge.net/reference.html#constructor0>;
> try {
> // run command to print network configuration, depending on the operating system
> #ifdef _WIN32
> es.start <http://libexecstream.sourceforge.net/reference.html#start1>( "ipconfig", "/all" );
> #else
> es.start <http://libexecstream.sourceforge.net/reference.html#start1>( "ifconfig", "-a" );
> #endif
>
> std::string s;
> while( std::getline( es.out <http://libexecstream.sourceforge.net/reference.html#out>(), s ).good() ) {
> // do something with s
> }
> }catch( std::exception const & e ) {
> std::cerr << "error: " << e.what() << "\n";
> }
>
> For more examples see the file test/exec-stream-test.cpp in the source
> distribution. The interface provided by the library is documented in the
> reference <http://libexecstream.sourceforge.net/reference.html>.
> Download
> Latest source release from SourceForge: follow this link
> <http://sourceforge.net/project/showfiles.php?group_id=103810&package_id=111533&release_id=230408>
> for downloading libexecstream-0.3.tar.gz
> Get source from the CVS:
> (password is empty) cvs
> -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream login
> cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libexecstream co
> libexecstream
> View source in the CVS:
> http://cvs.sourceforge.net/viewcvs.py/libexecstream
> Link to the SourceForge project page:
> http://sourceforge.net/projects/libexecstream/ Installation
>
> Libexecstream is provided in source code form only. In order to use it,
> you need to compile and link one file, exec-stream.cpp, into your
> program.
>
> On Linux, libexecstream was tested on Red Hat 9 with gcc compiler.
> Versions of gcc prior to 3.0 will not work. Make sure that exec-stream.h
> is found somewhere on the include path, compile exec-stream.cpp as usual,
> link your program with -lpthread. GCC must be configured with
> --enable-threads, which is by default on most Linux distributions.
>
> On Windows, libexecstream was tested on XP and 95 flavors with VC++ 7
> compiler. VC++ 6 will not work. Make sure that exec-stream.h is found
> somewhere on the include path, compile exec-stream.cpp as usual, link you
> program with multi-threaded runtime.
>
> Example makefiles for Windows and Linux (used to build the testsute) are
> provided in the test directory of the source distribution.
>
> The exec-stream.cpp file includes several platform-dependent
> implementation files. Selection of platform-specific implementation is done
> at compile time: when _WIN32 macro is defined (usually by windows
> compiler) win32 implementation is included, when that macro is not defined,
> posix implementation is included.
>
>
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f4a36785-fd36-4887-adcb-2be7490dbe09%40isocpp.org.
------=_Part_733_1377566033.1482062388774
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">only on caveat, that would be nice to fix in this library.=
...=C2=A0 its not really easy to do a getline of both stdout and stderr at t=
he same time..<br><br>On Sunday, December 18, 2016 at 6:57:38 AM UTC-5, wm2=
01...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Lib Exec Stream.=C2=A0 looks useful and simple:<br><br><a href=3D"=
http://libexecstream.sourceforge.net/" target=3D"_blank" rel=3D"nofollow" o=
nmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2F=
libexecstream.sourceforge.net%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHZ=
780dotTfEc-cn-FMHyrC2uUTXQ';return true;" onclick=3D"this.href=3D'h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F=
\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHZ780dotTfEc-cn-FMHyrC2uUTXQ';=
return true;">http://libexecstream.<wbr>sourceforge.net/</a><br><br><br>Why=
not add it to the STL?=C2=A0 <br><br><h1>The libexecstream library</h1>
<table><colgroup><col>
<col>
</colgroup><tbody><tr>
<td valign=3D"top">
<div><a href=3D"http://libexecstream.sourceforge.net/#overview" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F%23overvi=
ew\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFEhjFf2aO3MzGx36F3aZbmDwggyg'=
;;return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3d=
http%3A%2F%2Flibexecstream.sourceforge.net%2F%23overview\x26sa\x3dD\x26sntz=
\x3d1\x26usg\x3dAFQjCNFEhjFf2aO3MzGx36F3aZbmDwggyg';return true;">Overv=
iew</a></div>
<div><a href=3D"http://libexecstream.sourceforge.net/#download" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F%23downlo=
ad\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEx1RCp0uXKk7G2tOdBTdQeV20Ctg'=
;;return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3d=
http%3A%2F%2Flibexecstream.sourceforge.net%2F%23download\x26sa\x3dD\x26sntz=
\x3d1\x26usg\x3dAFQjCNEx1RCp0uXKk7G2tOdBTdQeV20Ctg';return true;">Downl=
oad</a></div>
<div><a href=3D"http://libexecstream.sourceforge.net/#installation=
" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http:/=
/www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F%23in=
stallation\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAGzvCD22nrij1tAwIru5bRA=
vlRg';return true;" onclick=3D"this.href=3D'http://www.google.com/u=
rl?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F%23installation\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAGzvCD22nrij1tAwIru5bRAvlRg';return =
true;">Installation</a></div>
<div><a href=3D"http://libexecstream.sourceforge.net/reference.htm=
l" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http:=
//www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Frefe=
rence.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJHF-fts0gjLOyn9NDLwTh8h=
zOhQ';return true;" onclick=3D"this.href=3D'http://www.google.com/u=
rl?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference.html\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJHF-fts0gjLOyn9NDLwTh8hzOhQ';return t=
rue;">Reference</a></div>
<div><a href=3D"http://libexecstream.sourceforge.net/news.html" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Fnews.html=
\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGZrQ1Kl8cty-guHRUbRxjZo83GPQ';=
return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3dht=
tp%3A%2F%2Flibexecstream.sourceforge.net%2Fnews.html\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNGZrQ1Kl8cty-guHRUbRxjZo83GPQ';return true;">News</a><=
/div>
<div><a href=3D"http://libexecstream.sourceforge.net/license.html"=
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://=
www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Flicens=
e.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGNl-lItMgITd2OZttElccapZp4gQ=
';return true;" onclick=3D"this.href=3D'http://www.google.com/url?q=
\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Flicense.html\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNGNl-lItMgITd2OZttElccapZp4gQ';return true;">=
License</a></div>
<div><a href=3D"http://sourceforge.net" target=3D"_blank" rel=3D"n=
ofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhtt=
p%3A%2F%2Fsourceforge.net\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExM3zulvZ=
284_iUgwjSwKGDPslCQ';return true;" onclick=3D"this.href=3D'http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Fsourceforge.net\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNExM3zulvZ284_iUgwjSwKGDPslCQ';return true;"><img src=
=3D"https://lh3.googleusercontent.com/proxy/8z9t1FsImgTxKjOm6AP0tToJQtQ7QFm=
0oK7Qt8LN5x4tzXyLNrQLiEkg-IwFda9hOHd37RZiCRdfeVG18hjO1lORgRmg_6D0klSd=3Dw50=
00-h5000" alt=3D"SourceForge.net Logo" width=3D"125" height=3D"37" border=
=3D"0"></a></div>
</td>
<td>
<h2><a name=3D"63c73c9f-3276-4fb1-87d0-ddbcc7b4440e@isocpp.org_overview"></=
a>Overview</h2>
<p>Libexecstream is a C++ library that allows you to run a child process an=
d have its input, output and error
avaliable as standard C++ streams.=20
</p>
<p>Like this:</p>
<pre>#include <exec-stream.h>
#include <string>
....
try {
exec_stream_t <a href=3D"http://libexecstream.sourceforge.net/reference=
..html#constructor1" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.=
href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourc=
eforge.net%2Freference.html%23constructor1\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNFeMM-mBlQzI5V_6a9FKiL1I2s1ng';return true;" onclick=3D"this.hre=
f=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourcefo=
rge.net%2Freference.html%23constructor1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dA=
FQjCNFeMM-mBlQzI5V_6a9FKiL1I2s1ng';return true;">es</a>( "perl&quo=
t;, "" ); <span>// run perl without any arguments </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#in" t=
arget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freferenc=
e.html%23in\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHgG96mDruMCVVBYqf4n5o_l=
dYLOA';return true;" onclick=3D"this.href=3D'http://www.google.com/=
url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference.html%23in\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHgG96mDruMCVVBYqf4n5o_ldYLOA';re=
turn true;">in</a>() << "print \"hello world\";";=
<span>// and make it print "hello world" </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#close=
_in" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'htt=
p://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Fre=
ference.html%23close_in\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhQdElqlqc3=
VnDiLoAw6ZGySejWA';return true;" onclick=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference=
..html%23close_in\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhQdElqlqc3VnDiLoA=
w6ZGySejWA';return true;">close_in</a>(); <span>=
// after the input was closed </span>
std::string hello, world;
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#out" =
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freferen=
ce.html%23out\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHY15XZA3v95Bja7JK5ADe=
_aOhnmQ';return true;" onclick=3D"this.href=3D'http://www.google.co=
m/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference.html%23ou=
t\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHY15XZA3v95Bja7JK5ADe_aOhnmQ'=
;return true;">out</a>() >> hello; <span>// read the first word of ou=
tput </span>
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#out" =
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freferen=
ce.html%23out\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHY15XZA3v95Bja7JK5ADe=
_aOhnmQ';return true;" onclick=3D"this.href=3D'http://www.google.co=
m/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference.html%23ou=
t\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHY15XZA3v95Bja7JK5ADe_aOhnmQ'=
;return true;">out</a>() >> world; <span>// read the second word </sp=
an>
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << &=
quot;\n";
}
</pre>
<p>Features:
</p><ul><li>Works on Linux and Windows</li><li>Uses threads</li><li>Does no=
t depend on any other non-standard library</li><li>Distributed as source co=
de only, requires you to compile and link one file into your program</li><l=
i>BSD-style <a href=3D"http://libexecstream.sourceforge.net/license.html" t=
arget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Flicense.=
html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGNl-lItMgITd2OZttElccapZp4gQ&#=
39;;return true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x=
3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Flicense.html\x26sa\x3dD\x26s=
ntz\x3d1\x26usg\x3dAFQjCNGNl-lItMgITd2OZttElccapZp4gQ';return true;">li=
cense</a></li></ul>
<p>Another example:
</p>
<pre>#include <exec-stream.h>
....
exec_stream_t <a href=3D"http://libexecstream.sourceforge.net/reference.htm=
l#constructor0" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=
=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourcefor=
ge.net%2Freference.html%23constructor0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAF=
QjCNHhiYoICiQAN2NwrMNqwUGFbh1dIA';return true;" onclick=3D"this.href=3D=
'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.=
net%2Freference.html%23constructor0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjC=
NHhiYoICiQAN2NwrMNqwUGFbh1dIA';return true;">es</a>;
try {
<span>// run command to print network configuration, depending on the o=
perating system</span>
#ifdef _WIN32
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#s=
tart1" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F=
reference.html%23start1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGuv-yQmvtTB=
7v86AQ2HViIH01j8A';return true;" onclick=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference=
..html%23start1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGuv-yQmvtTB7v86AQ2HV=
iIH01j8A';return true;">start</a>( "ipconfig", "/all&quo=
t; );
#else
es.<a href=3D"http://libexecstream.sourceforge.net/reference.html#s=
tart1" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F=
reference.html%23start1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGuv-yQmvtTB=
7v86AQ2HViIH01j8A';return true;" onclick=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2Freference=
..html%23start1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGuv-yQmvtTB7v86AQ2HV=
iIH01j8A';return true;">start</a>( "ifconfig", "-a"=
);
#endif
=20
std::string s;
while( std::getline( es.<a href=3D"http://libexecstream.sourceforge.net=
/reference.html#out" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this=
..href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sour=
ceforge.net%2Freference.html%23out\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCN=
HY15XZA3v95Bja7JK5ADe_aOhnmQ';return true;" onclick=3D"this.href=3D'=
;http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%=
2Freference.html%23out\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHY15XZA3v95B=
ja7JK5ADe_aOhnmQ';return true;">out</a>(), s ).good() ) {
<span>// do something with <var>s</var></span>
}
}catch( std::exception const & e ) {
std::cerr << "error: " << e.what() << &=
quot;\n";
}
</pre>
<p>For more examples see the file <var>test/exec-stream-test.cpp</var> in t=
he source distribution.=20
The interface provided by the library is documented in the <a href=3D"http:=
//libexecstream.sourceforge.net/reference.html" target=3D"_blank" rel=3D"no=
follow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Flibexecstream.sourceforge.net%2Freference.html\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNHJHF-fts0gjLOyn9NDLwTh8hzOhQ';return true;" onclic=
k=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecst=
ream.sourceforge.net%2Freference.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQ=
jCNHJHF-fts0gjLOyn9NDLwTh8hzOhQ';return true;">reference</a>.
</p>
<h2><a name=3D"63c73c9f-3276-4fb1-87d0-ddbcc7b4440e@isocpp.org_download"></=
a>Download</h2>
<table><tbody><tr><td>
Latest source release from SourceForge:
</td><td>
<a href=3D"http://sourceforge.net/project/showfiles.php?group_id=3D103810&a=
mp;package_id=3D111533&release_id=3D230408" target=3D"_blank" rel=3D"no=
follow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fsourceforge.net%2Fproject%2Fshowfiles.php%3Fgroup_id%3D103810%26pa=
ckage_id%3D111533%26release_id%3D230408\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dA=
FQjCNExXRNcnLrddp2NSPMt7cKIFsR6Ng';return true;" onclick=3D"this.href=
=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fsourceforge.net%2Fproje=
ct%2Fshowfiles.php%3Fgroup_id%3D103810%26package_id%3D111533%26release_id%3=
D230408\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExXRNcnLrddp2NSPMt7cKIFsR6N=
g';return true;">follow this link</a> for downloading libexecstream-0.3=
..tar.gz
</td></tr></tbody></table>
<table><tbody><tr><td>
Get source from the CVS:
<br>(password is empty)
</td><td>
cvs -d:pserver:anonymous@cvs.<wbr>sourceforge.net:/cvsroot/<wbr>libexecstre=
am login=20
<br>cvs -z3 -d:pserver:anonymous@cvs.<wbr>sourceforge.net:/cvsroot/<wbr>lib=
execstream co libexecstream
</td></tr></tbody></table>
<table><tbody><tr><td>
View source in the CVS:
</td><td>
<a href=3D"http://cvs.sourceforge.net/viewcvs.py/libexecstream" target=3D"_=
blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.c=
om/url?q\x3dhttp%3A%2F%2Fcvs.sourceforge.net%2Fviewcvs.py%2Flibexecstream\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFG5cNcSi5GmMZyG8ou-eMB2REKAQ';re=
turn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fcvs.sourceforge.net%2Fviewcvs.py%2Flibexecstream\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNFG5cNcSi5GmMZyG8ou-eMB2REKAQ';return true;">http=
://cvs.sourceforge.net/<wbr>viewcvs.py/libexecstream</a>
</td></tr></tbody></table>
<table><tbody><tr><td>
Link to the SourceForge project page:
</td><td>
<a href=3D"http://sourceforge.net/projects/libexecstream/" target=3D"_blank=
" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/ur=
l?q\x3dhttp%3A%2F%2Fsourceforge.net%2Fprojects%2Flibexecstream%2F\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNGut1LSaBHKKMPOGWqCpRNkFFM8fA';return tru=
e;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2=
Fsourceforge.net%2Fprojects%2Flibexecstream%2F\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNGut1LSaBHKKMPOGWqCpRNkFFM8fA';return true;">http://sourcefo=
rge.net/<wbr>projects/libexecstream/</a>
</td></tr></tbody></table>
<h2><a name=3D"63c73c9f-3276-4fb1-87d0-ddbcc7b4440e@isocpp.org_installation=
"></a>Installation</h2>
<p>Libexecstream is provided in source code form only. In order to use it, =
you need to compile and link
one file, <var>exec-stream.cpp</var>, into your program.
</p>
<p>On Linux, libexecstream was tested on Red Hat 9 with gcc compiler. Versi=
ons of gcc prior to 3.0 will not work.
Make sure that <var>exec-stream.h</var> is found somewhere on the include p=
ath,=20
compile <var>exec-stream.cpp</var> as usual, link your program with <var>-l=
pthread</var>.
GCC must be configured with <var>--enable-threads</var>, which is by defaul=
t on most Linux distributions.
</p>
<p>On Windows, libexecstream was tested on XP and 95 flavors with VC++ 7 co=
mpiler. VC++ 6 will not work.=20
Make sure that <var>exec-stream.h</var> is found somewhere on the include p=
ath,=20
compile <var>exec-stream.cpp</var> as usual, link you program with multi-th=
readed runtime.
</p>
<p>Example makefiles for Windows and Linux (used to build the testsute) are=
provided in the <var>test</var> directory
of the source distribution.
</p>
<p>The <var>exec-stream.cpp</var> file includes several platform-dependent=
=20
implementation files. Selection of platform-specific implementation is done=
at compile time: when <var>_WIN32</var>
macro is defined (usually by windows compiler) win32 implementation is incl=
uded, when that macro is not defined,
posix implementation is included.
</p></td></tr></tbody></table><br><br></div></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f4a36785-fd36-4887-adcb-2be7490dbe09%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f4a36785-fd36-4887-adcb-2be7490dbe09=
%40isocpp.org</a>.<br />
------=_Part_733_1377566033.1482062388774--
------=_Part_732_1467615456.1482062388773--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Sun, 18 Dec 2016 10:01:56 -0800
Raw View
On domingo, 18 de dezembro de 2016 03:57:38 PST wm2015email@gmail.com wrote:
> Lib Exec Stream. looks useful and simple:
>
> http://libexecstream.sourceforge.net/
>
>
> Why not add it to the STL?
It should be rewritten to use the filesystem experimental API and brought into
line with C++17 first. At the very least for the program name, which on Windows
is a Unicode string, not a narrow character string, but I would expect the
timeouts to be represented by std::chrono types too.
More than that, the code seems to work only in synchronous mode, so support
for asynchronous would be important too -- I don't like the ASIO-inspired API
that seems to be going into the Standard Library, but if that's what we'll
standardise on, that's what it should use. Things like the ability to be
notified that there's new data available to be read at a later point in time.
I'd also be suspicious of software that hasn't seen any update in 12 years
(unless it's TeX). I can see at least one major bug in the POSIX
implementation handling SIGPIPE (it's not thread-safe and doesn't even allow
two simultaneous exec_streams). This is QoI in a standard, of course, but it
reflects in the API.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3748469.QirPY1Ymmj%40tjmaciei-mobl1.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 18 Dec 2016 10:36:25 -0800 (PST)
Raw View
------=_Part_1063_876969955.1482086185755
Content-Type: multipart/alternative;
boundary="----=_Part_1064_2033149653.1482086185756"
------=_Part_1064_2033149653.1482086185756
Content-Type: text/plain; charset=UTF-8
On Sunday, December 18, 2016 at 1:02:01 PM UTC-5, Thiago Macieira wrote:
>
> On domingo, 18 de dezembro de 2016 03:57:38 PST wm201...@gmail.com
> <javascript:> wrote:
> > Lib Exec Stream. looks useful and simple:
> >
> > http://libexecstream.sourceforge.net/
> >
> >
> > Why not add it to the STL?
>
> It should be rewritten to use the filesystem experimental API and brought
> into
> line with C++17 first. At the very least for the program name, which on
> Windows
> is a Unicode string, not a narrow character string, but I would expect the
> timeouts to be represented by std::chrono types too.
>
Well, that brings up the more general problem of dealing with
cross-platform command line parameters. In Win32, each parameter is a
separate parameter, and they can be encoded in Unicode (obviously along
with the path). In others, it's one string that gets parsed based on spaces.
It's not a simple matter to unify the two worlds. And those are just the
two I know about...
More than that, the code seems to work only in synchronous mode, so support
> for asynchronous would be important too -- I don't like the ASIO-inspired
> API
> that seems to be going into the Standard Library, but if that's what we'll
> standardise on, that's what it should use. Things like the ability to be
> notified that there's new data available to be read at a later point in
> time.
>
But that's how programs that use stream-based interfaces handle async
operations. If a program reads from stdin, then it will halt until the
amount of data it tries to read from stdin is ready. If your program reads
data from a process's stdout, then your program is going to halt until that
data is ready.
Async is built on top of that. If the program wants to asynchronously
process stdin, then they spawn a thread that makes the accesses to
`std::cin`, then calls the original thread back with the data, perhaps via
a promise/future interface. Same goes for asynchronously reading the stdout
of a process; if you want to do it asynchronously, you do it in your
application. Indeed, this would be one of the few times I would actually
use `std::async`. Asynchronous reading from a process would work like this:
exec_stream_t es( "perl", "" );
auto ftr = async([&es] {es.out >> ...});
Asynchronous getting of stdin would work in a similar way.
Now, I would love to see more process-based features, like real IPC
mechanisms besides streams. But if we're going to use streams, then they
should work in the way users typically deal with them: manual async rather
than automatic.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/2bed3eb2-f8f4-49d2-9135-e671a57ea3f5%40isocpp.org.
------=_Part_1064_2033149653.1482086185756
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, December 18, 2016 at 1:02:01 PM UTC-5, Thiago M=
acieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On domingo, 18 d=
e dezembro de 2016 03:57:38 PST <a href=3D"javascript:" target=3D"_blank" g=
df-obfuscated-mailto=3D"H8SNL0ARCwAJ" rel=3D"nofollow" onmousedown=3D"this.=
href=3D'javascript:';return true;" onclick=3D"this.href=3D'java=
script:';return true;">wm201...@gmail.com</a> wrote:
<br>> Lib Exec Stream. =C2=A0looks useful and simple:
<br>>=20
<br>> <a href=3D"http://libexecstream.sourceforge.net/" target=3D"_blank=
" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/ur=
l?q\x3dhttp%3A%2F%2Flibexecstream.sourceforge.net%2F\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNHZ780dotTfEc-cn-FMHyrC2uUTXQ';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Flibexecstr=
eam.sourceforge.net%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHZ780dotTfEc=
-cn-FMHyrC2uUTXQ';return true;">http://libexecstream.<wbr>sourceforge.n=
et/</a>
<br>>=20
<br>>=20
<br>> Why not add it to the STL?
<br>
<br>It should be rewritten to use the filesystem experimental API and broug=
ht into=20
<br>line with C++17 first. At the very least for the program name, which on=
Windows=20
<br>is a Unicode string, not a narrow character string, but I would expect =
the=20
<br>timeouts to be represented by std::chrono types too.<br></blockquote><d=
iv><br>Well, that brings up the more general problem of dealing with cross-=
platform command line parameters. In Win32, each parameter is a separate pa=
rameter, and they can be encoded in Unicode (obviously along with the path)=
.. In others, it's one string that gets parsed based on spaces.<br><br>I=
t's not a simple matter to unify the two worlds. And those are just the=
two I know about...<br><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;">
More than that, the code seems to work only in synchronous mode, so support=
=20
<br>for asynchronous would be important too -- I don't like the ASIO-in=
spired API=20
<br>that seems to be going into the Standard Library, but if that's wha=
t we'll=20
<br>standardise on, that's what it should use. Things like the ability =
to be=20
<br>notified that there's new data available to be read at a later poin=
t in time.<br></blockquote><div><br>But that's how programs that use st=
ream-based interfaces handle async operations. If a program reads from stdi=
n, then it will halt until the amount of data it tries to read from stdin i=
s ready. If your program reads data from a process's stdout, then your =
program is going to halt until that data is ready.<br><br>Async is built on=
top of that. If the program wants to asynchronously process stdin, then th=
ey spawn a thread that makes the accesses to `std::cin`, then calls the ori=
ginal thread back with the data, perhaps via a promise/future interface. Sa=
me goes for asynchronously reading the stdout of a process; if you want to =
do it asynchronously, you do it in your application. Indeed, this would be =
one of the few times I would actually use `std::async`. Asynchronous readin=
g from a process would work like this:<br><br><div style=3D"background-colo=
r: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: soli=
d; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><pre><span style=3D"=
color: #000;" class=3D"styled-by-prettify">exec_stream_t es</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;=
" class=3D"styled-by-prettify">"perl"</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"s=
tyled-by-prettify">""</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">);</span></pre><span style=3D"color: #008;" class=3D"styled-by-=
prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> ftr </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> async<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">([&</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">es</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">]</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">es</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">.</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">out</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">>>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">...});</span></div=
></code></div><br>Asynchronous getting of stdin would work in a similar way=
..<br><br>Now, I would love to see more process-based features, like real IP=
C mechanisms besides streams. But if we're going to use streams, then t=
hey should work in the way users typically deal with them: manual async rat=
her than automatic.</div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2bed3eb2-f8f4-49d2-9135-e671a57ea3f5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2bed3eb2-f8f4-49d2-9135-e671a57ea3f5=
%40isocpp.org</a>.<br />
------=_Part_1064_2033149653.1482086185756--
------=_Part_1063_876969955.1482086185755--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Sun, 18 Dec 2016 11:05:15 -0800
Raw View
On domingo, 18 de dezembro de 2016 10:36:25 PST Nicol Bolas wrote:
> But that's how programs that use stream-based interfaces handle async
> operations. If a program reads from stdin, then it will halt until the
> amount of data it tries to read from stdin is ready. If your program reads
> data from a process's stdout, then your program is going to halt until that
> data is ready.
>
> Async is built on top of that. If the program wants to asynchronously
> process stdin, then they spawn a thread that makes the accesses to
> `std::cin`, then calls the original thread back with the data, perhaps via
> a promise/future interface. Same goes for asynchronously reading the stdout
> of a process; if you want to do it asynchronously, you do it in your
> application. Indeed, this would be one of the few times I would actually
> use `std::async`. Asynchronous reading from a process would work like this:
I don't have to say that's nonsense.
Pipes and sockets can notify when there's data available for them to read (at
least on POSIX systems - pipes on Windows are weird). There's no need for
threading to handle three simple pipes to a child process.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3220615.uFdqAmu06H%40tjmaciei-mobl1.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 18 Dec 2016 11:24:12 -0800 (PST)
Raw View
------=_Part_1076_704051857.1482089052382
Content-Type: multipart/alternative;
boundary="----=_Part_1077_1231997097.1482089052382"
------=_Part_1077_1231997097.1482089052382
Content-Type: text/plain; charset=UTF-8
On Sunday, December 18, 2016 at 2:05:20 PM UTC-5, Thiago Macieira wrote:
>
> On domingo, 18 de dezembro de 2016 10:36:25 PST Nicol Bolas wrote:
> > But that's how programs that use stream-based interfaces handle async
> > operations. If a program reads from stdin, then it will halt until the
> > amount of data it tries to read from stdin is ready. If your program
> reads
> > data from a process's stdout, then your program is going to halt until
> that
> > data is ready.
> >
> > Async is built on top of that. If the program wants to asynchronously
> > process stdin, then they spawn a thread that makes the accesses to
> > `std::cin`, then calls the original thread back with the data, perhaps
> via
> > a promise/future interface. Same goes for asynchronously reading the
> stdout
> > of a process; if you want to do it asynchronously, you do it in your
> > application. Indeed, this would be one of the few times I would actually
> > use `std::async`. Asynchronous reading from a process would work like
> this:
>
> I don't have to say that's nonsense.
>
> Pipes and sockets can notify when there's data available for them to read
> (at
> least on POSIX systems - pipes on Windows are weird). There's no need for
> threading to handle three simple pipes to a child process.
>
If you're on a POSIX platform, you can do things the POSIX way. But we're
talking about a standard library feature, which by definition must be cross
platform. And the cross-platform way for such things is with streams. Which
are synchronous.
Now, if you want to invent an asynchronous stream system, perhaps we can
work with that, so long as it is portable. But until then, I don't see the
problem with using synchronous stream interfaces.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/54664aff-07e0-448a-be54-6faa2dc079a2%40isocpp.org.
------=_Part_1077_1231997097.1482089052382
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, December 18, 2016 at 2:05:20 PM UTC-5, =
Thiago Macieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On domin=
go, 18 de dezembro de 2016 10:36:25 PST Nicol Bolas wrote:
<br>> But that's how programs that use stream-based interfaces handl=
e async
<br>> operations. If a program reads from stdin, then it will halt until=
the
<br>> amount of data it tries to read from stdin is ready. If your progr=
am reads
<br>> data from a process's stdout, then your program is going to ha=
lt until that
<br>> data is ready.
<br>>=20
<br>> Async is built on top of that. If the program wants to asynchronou=
sly
<br>> process stdin, then they spawn a thread that makes the accesses to
<br>> `std::cin`, then calls the original thread back with the data, per=
haps via
<br>> a promise/future interface. Same goes for asynchronously reading t=
he stdout
<br>> of a process; if you want to do it asynchronously, you do it in yo=
ur
<br>> application. Indeed, this would be one of the few times I would ac=
tually
<br>> use `std::async`. Asynchronous reading from a process would work l=
ike this:
<br>
<br>I don't have to say that's nonsense.
<br>
<br>Pipes and sockets can notify when there's data available for them t=
o read (at=20
<br>least on POSIX systems - pipes on Windows are weird). There's no ne=
ed for=20
<br>threading to handle three simple pipes to a child process.<br></blockqu=
ote><div><br>If you're on a POSIX platform, you can do things the POSIX=
way. But we're talking about a standard library feature, which by defi=
nition must be cross platform. And the cross-platform way for such things i=
s with streams. Which are synchronous.<br><br>Now, if you want to invent an=
asynchronous stream system, perhaps we can work with that, so long as it i=
s portable. But until then, I don't see the problem with using synchron=
ous stream interfaces.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/54664aff-07e0-448a-be54-6faa2dc079a2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/54664aff-07e0-448a-be54-6faa2dc079a2=
%40isocpp.org</a>.<br />
------=_Part_1077_1231997097.1482089052382--
------=_Part_1076_704051857.1482089052382--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Wed, 21 Dec 2016 16:36:54 -0500
Raw View
On 2016-12-18 13:36, Nicol Bolas wrote:
> Well, that brings up the more general problem of dealing with
> cross-platform command line parameters. In Win32, each parameter is a
> separate parameter, and they can be encoded in Unicode (obviously along
> with the path). In others, it's one string that gets parsed based on spaces.
Er... what? Do you have that backwards?
In traditional C (which is what POSIX platforms use), we have `main(int
argc, char** argv)`. The parameters are separated by the time the
program sees them, and new processes are launched with arrays that look
like this. The only place argument splitting happens is in your shell.
IIRC this is, sadly, not true on Windows, although I think there are at
least OS functions to perform splitting (and deal with quoting and such).
If everyone would just agree to use UTF-8, then everyone could use the C
standard interface, and all would be well :-).
On 2016-12-18 14:24, Nicol Bolas wrote:
> On Sunday, December 18, 2016 at 2:05:20 PM UTC-5, Thiago Macieira wrote:
>> Pipes and sockets can notify when there's data available for them
>> to read (at least on POSIX systems - pipes on Windows are weird).
>> There's no need for threading to handle three simple pipes to a
>> child process.
>
> If you're on a POSIX platform, you can do things the POSIX way. But we're
> talking about a standard library feature, which by definition must be cross
> platform.
That's nice, but... the POSIX way is a very good design, the Windows way
is a *bad* design. I would much rather use standardization as a means
for "encouraging" platform vendors to use good designs, rather than
standardizing on a horrible API because it is the lowest common denominator.
Note: I don't mean we can't also have synchronous streams. I have no
issue with those; they are (normally) easier to use than *any*
asynchronous mechanism, and are just fine for many use cases. My issue
is with backward and idiotic designs for asynchronous communication.
--
Matthew
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/585AF5F6.9090704%40gmail.com.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 21 Dec 2016 17:29:13 -0800 (PST)
Raw View
------=_Part_24_825523255.1482370153792
Content-Type: multipart/alternative;
boundary="----=_Part_25_1379516157.1482370153792"
------=_Part_25_1379516157.1482370153792
Content-Type: text/plain; charset=UTF-8
On Wednesday, December 21, 2016 at 4:36:57 PM UTC-5, Matthew Woehlke wrote:
>
> On 2016-12-18 13:36, Nicol Bolas wrote:
> > Well, that brings up the more general problem of dealing with
> > cross-platform command line parameters. In Win32, each parameter is a
> > separate parameter, and they can be encoded in Unicode (obviously along
> > with the path). In others, it's one string that gets parsed based on
> spaces.
>
> Er... what? Do you have that backwards?
>
I seem to recall `CreateProcess` taking an array of command line
parameters. But I just checked the docs, and apparently that's not the case.
In traditional C (which is what POSIX platforms use), we have `main(int
> argc, char** argv)`. The parameters are separated by the time the
> program sees them, and new processes are launched with arrays that look
> like this. The only place argument splitting happens is in your shell.
>
> IIRC this is, sadly, not true on Windows, although I think there are at
> least OS functions to perform splitting (and deal with quoting and such).
>
`wmain` does take split arguments. I was talking about the code that
actually creates the process, not the `main` that gets called in the new
process.
On 2016-12-18 14:24, Nicol Bolas wrote:
> > On Sunday, December 18, 2016 at 2:05:20 PM UTC-5, Thiago Macieira wrote:
> >> Pipes and sockets can notify when there's data available for them
> >> to read (at least on POSIX systems - pipes on Windows are weird).
> >> There's no need for threading to handle three simple pipes to a
> >> child process.
> >
> > If you're on a POSIX platform, you can do things the POSIX way. But
> we're
> > talking about a standard library feature, which by definition must be
> cross
> > platform.
>
> That's nice, but... the POSIX way is a very good design, the Windows way
> is a *bad* design.
That's more or less irrelevant. Developing a standard that's not
implementable, or not able to be reasonably implemented, on a major
platform is a non-starter. I'm not saying that this is the case for what
you're proposing. But you can't just say, "X is better than Y, so let's
make everyone do it the way X does it."
That also doesn't change the fact that C++ has no concept of an
asynchronous stream. So you'd have to figure out how that's supposed to
work first.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/960abd6c-79d4-48bb-8fec-c324c2c10ef6%40isocpp.org.
------=_Part_25_1379516157.1482370153792
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, December 21, 2016 at 4:36:57 PM UTC-5, Matth=
ew Woehlke wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 2016-12-18=
13:36, Nicol Bolas wrote:
<br>> Well, that brings up the more general problem of dealing with=20
<br>> cross-platform command line parameters. In Win32, each parameter i=
s a=20
<br>> separate parameter, and they can be encoded in Unicode (obviously =
along=20
<br>> with the path). In others, it's one string that gets parsed ba=
sed on spaces.
<br>
<br>Er... what? Do you have that backwards?<br></blockquote><div><br>I seem=
to recall `CreateProcess` taking an array of command line parameters. But =
I just checked the docs, and apparently that's not the case.<br><br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;">
In traditional C (which is what POSIX platforms use), we have `main(int
<br>argc, char** argv)`. The parameters are separated by the time the
<br>program sees them, and new processes are launched with arrays that look
<br>like this. The only place argument splitting happens is in your shell.
<br>
<br>IIRC this is, sadly, not true on Windows, although I think there are at
<br>least OS functions to perform splitting (and deal with quoting and such=
).<br></blockquote><div><br>`wmain` does take split arguments. I was talkin=
g about the code that actually creates the process, not the `main` that get=
s called in the new process.<br><br></div><blockquote class=3D"gmail_quote"=
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-=
left: 1ex;">
On 2016-12-18 14:24, Nicol Bolas wrote:
<br>> On Sunday, December 18, 2016 at 2:05:20 PM UTC-5, Thiago Macieira =
wrote:
<br>>> Pipes and sockets can notify when there's data available f=
or them=20
<br>>> to read (at least on POSIX systems - pipes on Windows are weir=
d).
<br>>> There's no need for threading to handle three simple pipes=
to a
<br>>> child process.
<br>>=20
<br>> If you're on a POSIX platform, you can do things the POSIX way=
.. But we're=20
<br>> talking about a standard library feature, which by definition must=
be cross=20
<br>> platform.
<br>
<br>That's nice, but... the POSIX way is a very good design, the Window=
s way
<br>is a *bad* design.</blockquote><div><br>That's more or less irrelev=
ant. Developing a standard that's not implementable, or not able to be =
reasonably implemented, on a major platform is a non-starter. I'm not s=
aying that this is the case for what you're proposing. But you can'=
t just say, "X is better than Y, so let's make everyone do it the =
way X does it."<br><br>That also doesn't change the fact that C++ =
has no concept of an asynchronous stream. So you'd have to figure out h=
ow that's supposed to work first.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/960abd6c-79d4-48bb-8fec-c324c2c10ef6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/960abd6c-79d4-48bb-8fec-c324c2c10ef6=
%40isocpp.org</a>.<br />
------=_Part_25_1379516157.1482370153792--
------=_Part_24_825523255.1482370153792--
.