Elly Jones | 0b6bd18 | 2012-02-14 18:24:22 -0500 | [diff] [blame] | 1 | // 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-Jones | d9a16cd | 2012-11-12 16:09:49 -0500 | [diff] [blame] | 10 | |
Elly Jones | 0b6bd18 | 2012-02-14 18:24:22 -0500 | [diff] [blame] | 11 | namespace debugd { |
| 12 | |
| 13 | const char* const kTar = "/bin/tar"; |
| 14 | const char* const kSystemLogs = "/var/log"; |
| 15 | |
| 16 | DebugLogsTool::DebugLogsTool() { } |
| 17 | DebugLogsTool::~DebugLogsTool() { } |
| 18 | |
| 19 | void DebugLogsTool::GetDebugLogs(const DBus::FileDescriptor& fd, |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 20 | DBus::Error* error) { |
Jonathan Backer | 7b806fd | 2013-04-18 15:00:58 -0400 | [diff] [blame] | 21 | 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 Jones | 0b6bd18 | 2012-02-14 18:24:22 -0500 | [diff] [blame] | 28 | } |
| 29 | |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 30 | } // namespace debugd |