blob: ff3084748f09c2774f12b1efbf838e1fe9a440dd [file] [log] [blame]
Elly Jones0b6bd182012-02-14 18:24:22 -05001// Copyright (c) 2012 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#include "debug_logs_tool.h"
6
7#include <base/file_util.h>
8#include <chromeos/process.h>
9
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -050010
Elly Jones0b6bd182012-02-14 18:24:22 -050011namespace debugd {
12
13const char* const kTar = "/bin/tar";
14const char* const kSystemLogs = "/var/log";
15
16DebugLogsTool::DebugLogsTool() { }
17DebugLogsTool::~DebugLogsTool() { }
18
19void DebugLogsTool::GetDebugLogs(const DBus::FileDescriptor& fd,
20 DBus::Error& error) {
Jonathan Backer7b806fd2013-04-18 15:00:58 -040021 chromeos::ProcessImpl p;
22 p.AddArg(kTar);
23 p.AddArg("-c");
24 p.AddArg("-z");
25 p.AddArg(kSystemLogs);
26 p.BindFd(fd.get(), STDOUT_FILENO);
27 p.Run();
Elly Jones0b6bd182012-02-14 18:24:22 -050028}
29
30}; // namespace debugd