blob: 6b90726b0bc5c19c0a1e0fe4bd18a5636c255527 [file] [log] [blame]
Elly Jonesad1e9d92012-07-20 15:39:23 -04001// 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
Alex Vakulenko262be3f2014-07-30 15:25:50 -07005#include "debugd/src/netif_tool.h"
Elly Jonesad1e9d92012-07-20 15:39:23 -04006
Alex Vakulenko262be3f2014-07-30 15:25:50 -07007#include "debugd/src/process_with_output.h"
Elly Jonesad1e9d92012-07-20 15:39:23 -04008
Elly Jonesad1e9d92012-07-20 15:39:23 -04009namespace debugd {
10
Elly Jonesad1e9d92012-07-20 15:39:23 -040011std::string NetifTool::GetInterfaces(DBus::Error* error) {
Ben Chan297c3c22013-07-17 17:34:12 -070012 std::string path;
13 if (!SandboxedProcess::GetHelperPath("netif", &path))
Elly Jonesad1e9d92012-07-20 15:39:23 -040014 return "<path too long>";
Ben Chan297c3c22013-07-17 17:34:12 -070015
Elly Jonesad1e9d92012-07-20 15:39:23 -040016 ProcessWithOutput p;
17 if (!p.Init())
18 return "<can't create process>";
19 p.AddArg(path);
20 p.Run();
21 std::string out;
22 p.GetOutput(&out);
23 return out;
24}
25
26} // namespace debugd