X-Git-Url: https://git.syn-net.org/debian/?a=blobdiff_plain;f=src%2FsysExec.h;h=7b99638b659b1e464306e27d0f51305d5b4d8dc4;hb=bd02a5f6be4815d46524d613f727199ca756c971;hp=e6084726112cd382d2d13f160f7871738afd4ccb;hpb=f9ad69dfae6bcec427652b0c4230603e465bd544;p=anytun.git diff --git a/src/sysExec.h b/src/sysExec.h index e608472..7b99638 100644 --- a/src/sysExec.h +++ b/src/sysExec.h @@ -11,7 +11,7 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. @@ -33,8 +33,6 @@ #ifndef ANYTUN_sysExec_h_INCLUDED #define ANYTUN_sysExec_h_INCLUDED -#ifndef NO_EXEC - #include #include #include @@ -42,11 +40,35 @@ typedef std::vector StringVector; typedef std::list StringList; -void anytun_exec(std::string const& script); -void anytun_exec(std::string const& script, StringVector const& args); -void anytun_exec(std::string const& script, StringList const& env); -void anytun_exec(std::string const& script, StringVector const& args, StringList const& env); -void waitForScript(std::string const& script, pid_t pid, int pipefd); +class SysExec +{ +public: + SysExec(std::string const& script); + SysExec(std::string const& script, StringVector args); + SysExec(std::string const& script, StringList env); + SysExec(std::string const& script, StringVector args, StringList env); + ~SysExec(); + + int waitForScript(); + int getReturnCode() const; + + static void waitAndDestroy(SysExec*& s); + +private: + void doExec(StringVector args, StringList env); + std::string script_; + bool closed_; +#ifdef _MSC_VER + PROCESS_INFORMATION process_info_; + DWORD return_code_; +#else + pid_t pid_; + int pipefd_; + int return_code_; #endif + + +}; + #endif