DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Executable.hpp
Go to the documentation of this file.
1/*
2 * Executable.h
3 * OksSystem
4 *
5 * Created by Matthias Wiesmann on 06.01.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9
10#ifndef OKSSYSTEM_EXECUTABLE
11#define OKSSYSTEM_EXECUTABLE
12
13#include <map>
14#include <vector>
15
16#include "okssystem/File.hpp"
17#include "okssystem/Process.hpp"
18
19namespace OksSystem {
20
29 class Executable : public File {
30
31public:
32 typedef std::vector<std::string> param_collection ;
33 typedef std::map<std::string, std::string> env_collection ;
34protected:
35 void exec(char** argv) const ;
36 void exec(char** const argv, char** const env) const ;
37 static const char* const SHELL_COMMAND ;
38 static const char* const SHELL_COMMAND_PARAM ;
39 static void copy_fd(int fd, std::ostream &target) ;
40public:
41 static std::string okssystem(const std::string &command);
43 Executable(const OksSystem::File &file) ;
44 Executable(const char* filename) ;
45 Executable(const std::string &filename) ;
46 ~Executable() ;
47
48 void exec() const ;
49 void exec(const param_collection &params) const ;
50 std::string pipe_in(const param_collection &params) const ;
51 std::string pipe_in(const param_collection &params, const env_collection &envs) const ;
52 Process pipe_out(const param_collection &params, const File &input_file, const File &output_file, const File &error_file, mode_t perm) const ;
53 Process pipe_out(const param_collection &params, const env_collection &envs, const File &input_file, const File &output_file, const File &error_file, mode_t perm) const ;
54 void exec(const param_collection &params, const env_collection &envs) const ;
55 Process start(const param_collection &params) const ;
56 Process start_and_forget(const param_collection &params) const ;
57 Process start(const param_collection &params, const env_collection &envs) const ;
59 std::string to_string(const param_collection &params) const ;
61 } ; // Executable
62
63} // OksSystem
64
65#endif
66
Wrapper for executable file manipulation.
Process start_and_forget(const param_collection &params) const
start the executable in another process; do not wait for termination of child
Executable(const OksSystem::File &file)
std::string pipe_in(const param_collection &params) const
run the executable and pipe results back
Process pipe_out(const param_collection &params, const File &input_file, const File &output_file, const File &error_file, mode_t perm) const
static const char *const SHELL_COMMAND
command to execute in a shell
Process start(const param_collection &params) const
start the executable in another process
static std::string okssystem(const std::string &command)
execute a command in a shell
static const char *const SHELL_COMMAND_PARAM
parameter to execute in a shell
std::string to_string(const param_collection &params) const
converts executable name and a parameter sequence into a string
void exec() const
run the executable
static void copy_fd(int fd, std::ostream &target)
copies the content of a file descriptor into a STL stream
std::vector< std::string > param_collection
std::map< std::string, std::string > env_collection
Wrapper for file operations.
Definition File.hpp:32
Wrapper for process manipulation.
Definition Process.hpp:25