API
 
Loading...
Searching...
No Matches
runCommand.hpp
Go to the documentation of this file.
1/** \file runCommand.hpp
2 * \brief Run a command get the output.
3 * \author Jared R. Males (jaredmales@gmail.com)
4 *
5 * \ingroup sys_files
6 */
7
8#ifndef sys_runCommand_hpp
9#define sys_runCommand_hpp
10
11#include <string>
12#include <vector>
13
14namespace MagAOX
15{
16namespace sys
17{
18
19/// Runs a command (with parameters) passed in using fork/exec
20/** New process is made with fork(), and child runs execvp with command provided.
21 *
22 * Original code by C. Bohlman for sysMonitor, then promoted to libMagAOX for general use.
23 *
24 * \returns 0 on success
25 * \returns -1 on error
26 *
27 * \ingroup sys
28 */
29int runCommand( std::vector<std::string> & commandOutput, ///< [out] the output, line by line. If an error, first entry contains the message.
30 std::vector<std::string> & commandStderr, ///< [out] the output of stderr.
31 std::vector<std::string> & commandList ///< [in] command to be run, with one entry per command line word
32 );
33
34} //namespace sys
35} //namespace MagAOX
36
37#endif //sys_thSetuid_hpp
38
int runCommand(std::vector< std::string > &commandOutput, std::vector< std::string > &commandStderr, std::vector< std::string > &commandList)
Runs a command (with parameters) passed in using fork/exec.
Definition dm.hpp:24