|
Boost Users : |
Subject: Re: [Boost-users] Boost Process Sync example hanging
From: Shubha Ramani (shubharamani_at_[hidden])
Date: 2016-08-31 17:23:48
Why doesn't this code work in Linux (Ubuntu) ?  I'm trying to run "ls -al" (the Linux ls command)                                                                  #include <boost/process.hpp>                          #include <boost/system/error_code.hpp>                     #include <boost/iostreams/device/file_descriptor.hpp>              #include <boost/iostreams/stream.hpp>                      #include <boost/asio.hpp>                            #include <boost/algorithm/string/predicate.hpp>                 #include <string>                                #include <istream>                               #include <cstdlib>                               #include <iostream>                                                                                           int main(int argc, char* argv[])                               {                                                bp::pipe p = bp::create_pipe();                                                                               {                                                bio::file_descriptor_sink sink(p.sink, bio::close_handle);                  boost::system::error_code ec;                                 bp::execute(                                               bpi::run_exe("ls"),                                      bpi::set_cmd_line(" -al"),                                  bpi::bind_stdout(sink),                                    bpi::set_on_error(ec)                                     );                                        //   BOOST_CHECK(!ec);                                   }                                                                                              bio::file_descriptor_source source(p.source, bio::close_handle);               bio::stream<bio::file_descriptor_source> is(source);                                                                    std::string s;                                        is >> s;                                           cout << "here " << s << endl;                                                                               }                                                                                                             Â
                                                          Â
 Shubha D. Ramanishubharamani_at_[hidden]
shubharamani_at_[hidden]
On Wednesday, August 31, 2016 11:03 AM, Shubha Ramani <shubharamani_at_[hidden]> wrote:
on Linux.
This code hangs at getline. Â I replaced "test.exe" with "ls". Why doesn't it work ?
 https://github.com/BorisSchaeling/boost-process/blob/master/libs/process/example/sync_io.cpp
Shubha D. Ramanishubharamani_at_[hidden]
shubharamani_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net