blob: 69c5cc06a2170cd22bc774f67b792d44ed8b3aed [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,
Ben Chana0011d82014-05-13 00:19:29 -070020 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
Ben Chana0011d82014-05-13 00:19:29 -070030} // namespace debugd