Mir
popen.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
17  */
18 
19 
20 #ifndef MIR_TEST_POPEN_H_
21 #define MIR_TEST_POPEN_H_
22 
23 #include <cstdio>
24 #include <memory>
25 #include <string>
26 
27 namespace mir
28 {
29 namespace test
30 {
34 class Popen
35 {
36 public:
37  Popen(std::string const& cmd);
38 
43  bool get_line(std::string& line);
44 
45 private:
46  Popen() = delete;
47  Popen(Popen const&) = delete;
48  Popen& operator=(Popen const&) = delete;
49  std::unique_ptr<std::FILE, void(*)(FILE* f)> raw_stream;
50 };
51 
52 }
53 }
54 
55 #endif
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: blob.h:26
bool get_line(std::string &line)
Read a line from the output of the executed command returns false if there is nothing more to read...
Popen - A popen c++ wrapper.
Definition: popen.h:34

Copyright © 2012-2018 Canonical Ltd.
Generated on Sun Jun 17 06:26:29 UTC 2018