Elly Jones | 1c4c3a1 | 2011-12-20 15:01:59 -0500 | [diff] [blame^] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef PROCESS_WITH_OUTPUT_H |
| 6 | #define PROCESS_WITH_OUTPUT_H |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include <base/file_path.h> |
| 12 | #include <chromeos/process.h> |
| 13 | |
| 14 | namespace debugd { |
| 15 | |
| 16 | // @brief Represents a process whose output can be collected. |
| 17 | // |
| 18 | // The process must be Run() to completion before its output can be collected. |
| 19 | class ProcessWithOutput : public chromeos::ProcessImpl { |
| 20 | public: |
| 21 | ProcessWithOutput(); |
| 22 | ~ProcessWithOutput(); |
| 23 | bool Init(); |
| 24 | bool GetOutput(std::string* output); |
| 25 | bool GetOutputLines(std::vector<std::string>* output); |
| 26 | private: |
| 27 | FilePath outfile_path_; |
| 28 | FILE *outfile_; |
| 29 | }; |
| 30 | |
| 31 | }; // namespace debugd |
| 32 | |
| 33 | #endif // PROCESS_WITH_OUTPUT_H |