logging reflow

This commit is contained in:
Master
2020-06-20 20:09:32 -04:00
parent 11829aca39
commit 839c3d398a
22 changed files with 370 additions and 332 deletions

15
src/Sproc/Sproc.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include "Sproc.h"
#include <unistd.h>
#include <cstring>
#include <wait.h>
/// Sproc::execute
///
/// \param input - The commandline input to execute.
/// \return - The return code of the execution of input in the calling shell.
int Sproc::execute(std::string input) {
int child_exit_code = -666;
child_exit_code = system( input.c_str() );
child_exit_code = WEXITSTATUS( child_exit_code );
return child_exit_code;
}

35
src/Sproc/Sproc.h Normal file
View File

@@ -0,0 +1,35 @@
/*
Examplar - An automation and testing framework.
© SURRO INDUSTRIES and Chris Punches, 2017.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FTESTS_SPROC_H
#define FTESTS_SPROC_H
#include <string>
#include <iostream>
// executes a subprocess and captures STDOUT, STDERR, and return code.
// should be able to recieve path of binary to be executed as well as any parameters
class Sproc {
public:
// call the object. returnvalue is enum representing external execution attempt not binary exit code
static int execute( std::string input );
};
#endif //FTESTS_SPROC_H