~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to tests/mir_test/popen.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
ImportĀ upstreamĀ versionĀ 0.8.0+14.10.20141010

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <boost/iostreams/device/file_descriptor.hpp>
24
24
#include <boost/iostreams/stream_buffer.hpp>
25
25
 
26
 
#include <stdexcept>
 
26
#include <system_error>
27
27
 
28
28
namespace mt = mir::test;
29
29
namespace io = boost::iostreams;
35
35
    if (raw_stream == nullptr)
36
36
    {
37
37
        BOOST_THROW_EXCEPTION(
38
 
            boost::enable_error_info(std::runtime_error("popen failed"))
39
 
                << boost::errinfo_errno(errno));
 
38
            boost::enable_error_info(std::system_error(errno, std::system_category(), "popen failed")));
40
39
    }
41
40
 
42
41
    int fd = fileno(raw_stream);
43
42
    if (fd == -1)
44
43
    {
45
44
        BOOST_THROW_EXCEPTION(
46
 
            boost::enable_error_info(std::runtime_error("invalid file stream"))
47
 
                << boost::errinfo_errno(errno));
 
45
            boost::enable_error_info(
 
46
                std::system_error(errno, std::system_category(), "invalid file stream")));
48
47
    }
49
48
    auto raw = new io::stream_buffer<io::file_descriptor_source>{
50
49
        fd, io::never_close_handle};