| 1 | /**************************************************************************
|
|---|
| 2 | * Copyright (C) 2004-2008 by Michael Medin <michael@medin.name> *
|
|---|
| 3 | * *
|
|---|
| 4 | * This code is part of NSClient++ - http://trac.nakednuns.org/nscp *
|
|---|
| 5 | * *
|
|---|
| 6 | * This program is free software; you can redistribute it and/or modify *
|
|---|
| 7 | * it under the terms of the GNU General Public License as published by *
|
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or *
|
|---|
| 9 | * (at your option) any later version. *
|
|---|
| 10 | * *
|
|---|
| 11 | * This program is distributed in the hope that it will be useful, *
|
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|---|
| 14 | * GNU General Public License for more details. *
|
|---|
| 15 | * *
|
|---|
| 16 | * You should have received a copy of the GNU General Public License *
|
|---|
| 17 | * along with this program; if not, write to the *
|
|---|
| 18 | * Free Software Foundation, Inc., *
|
|---|
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|---|
| 20 | ***************************************************************************/
|
|---|
| 21 | #pragma once
|
|---|
| 22 |
|
|---|
| 23 | namespace process {
|
|---|
| 24 | class Exception {
|
|---|
| 25 | std::wstring error_;
|
|---|
| 26 | public:
|
|---|
| 27 | Exception(std::wstring error) : error_(error) {}
|
|---|
| 28 | std::wstring getMessage() {
|
|---|
| 29 | return error_;
|
|---|
| 30 | }
|
|---|
| 31 | };
|
|---|
| 32 |
|
|---|
| 33 | class exec_arguments {
|
|---|
| 34 | public:
|
|---|
| 35 | exec_arguments(std::wstring root_path_, std::wstring command_, unsigned int timeout_)
|
|---|
| 36 | : root_path(root_path_)
|
|---|
| 37 | , command(command_)
|
|---|
| 38 | , timeout(timeout_)
|
|---|
| 39 | {}
|
|---|
| 40 |
|
|---|
| 41 | std::wstring root_path;
|
|---|
| 42 | std::wstring command;
|
|---|
| 43 | unsigned int timeout;
|
|---|
| 44 | };
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | #ifdef _WIN32
|
|---|
| 48 | #include "execute_process_w32.hpp"
|
|---|
| 49 | #else
|
|---|
| 50 | #include "execute_process_unix.hpp"
|
|---|
| 51 | #endif
|
|---|
| 52 |
|
|---|