blob: 46e98a549bcd0b9ffae9e0a31f21697a699050d1 [file] [log] [blame]
Elly Jonesa44d22d2012-01-05 18:05:56 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Elly Jones1c4c3a12011-12-20 15:01:59 -05002// 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
14namespace 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.
19class 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