Boost C++ Libraries: Ticket #13321: boost::process: executable extension is required to create a process. https://svn.boost.org/trac10/ticket/13321 <p> The following code does not assert under Windows: </p> <pre class="wiki">int main( int argc, char* argv[] ) { try { boost::process::child p( "cmd" ); p.terminate(); } catch (...) { assert( false ); } try { boost::process::child p( "cmd.exe" ); p.terminate(); } catch (...) { assert( false ); } return 0; } </pre><p> So, apparently, .exe does not need to be specified. </p> <p> However, the following code does assert when .exe is not specified: </p> <pre class="wiki">int main( int argc, char* argv[] ) { if ( argc == 1 ) { std::string exe = argv[0]; try { std::string exeNoExt = exe.substr(0, exe.find_last_of(".")); boost::process::child p( exeNoExt, "foo" ); p.terminate(); } catch (...) { assert( false ); // asserts } try { boost::process::child p( exe, "foo" ); p.terminate(); } catch (...) { assert( false ); // does not assert } } </pre><p> boost::process::child p( exeNoExt, "foo" ); should work and executable extention should be silently added, like it is for cmd. </p> <p> Note that boost::process::search_path( "myprg" ) returns "myprg.exe" if found, so here, extension is added correctly. But it's unsafe to systematically call this function priori to creating a child as it only works with program names (calling it with "Myfolder/myprg" returns ""). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13321 Trac 1.4.3 jpo38 <jean.porcherot@…> Tue, 05 Dec 2017 07:15:06 GMT component changed; owner set https://svn.boost.org/trac10/ticket/13321#comment:1 https://svn.boost.org/trac10/ticket/13321#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Beman Dawes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> </ul> Ticket