Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
execute.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file src/basic/execute.hh
11 /// @brief Various functions to run external executables
12 /// @author Sergey Lyskov
13 ///
14 /// Note: this code is placed in to 'basic' level instead of utility because we want to have access to Tracers so verbosity of all external calls could be controlled
15 
16 #ifndef INCLUDED_basic_execute_hh
17 #define INCLUDED_basic_execute_hh
18 
19 #include <string>
20 
21 namespace basic {
22 
23 
24 /// @brief Struct that hold result code + output of external process
26 public:
27  int result; // result code, zero if no error and otherwise will contain error code
28  std::string output;
29 
30 #ifdef HAS_MOVE_SEMANTICS
31  ExecutionResult(ExecutionResult &&r) =default; //{ result=r.result; output=std::move(r.output); }
32 #endif
33 };
34 
35 /// @brief excute provided command_line though shell and return exit_code and output
36 ExecutionResult execute(std::string const & message, std::string const & command_line, bool terminate_on_failure=true, bool silent=false);
37 
38 
39 } // namespace basic
40 
41 
42 
43 #endif // INCLUDED_basic_execute_hh
std::string output
Definition: execute.hh:28
ExecutionResult execute(std::string const &message, std::string const &command_line, bool terminate_on_failure, bool silent)
excute provided command_line though shell and return exit_code and output
Definition: execute.cc:34
Struct that hold result code + output of external process.
Definition: execute.hh:25
int const silent
Named verbosity levels.