Belle II Software development
CommandLine Class Reference

Static Public Member Functions

static int run_shell (const std::string &cmdstr, std::string &respstr)
 

Detailed Description

Definition at line 20 of file CommandLine.h.

Constructor & Destructor Documentation

◆ CommandLine()

CommandLine ( )
inline

Definition at line 22 of file CommandLine.h.

22{}; // Constructor

◆ ~CommandLine()

~CommandLine ( )
inline

Definition at line 23 of file CommandLine.h.

23{}; // Destructor

Member Function Documentation

◆ run_shell()

int run_shell ( const std::string &  cmdstr,
std::string &  respstr 
)
static

Definition at line 14 of file CommandLine.cc.

15{
16 FILE* fp = ::popen(cmdline.c_str(), "r");
17 if (fp == NULL) {
18 fprintf(stderr, "run_shell: Error to run command : %s\n", cmdline.c_str());
19 return -1;
20 }
21 char buf[4096];
22 fgets(buf, 4096, fp);
23 buf[strlen(buf) - 1] = '\0';
24 response = std::string(buf);
25 fclose(fp);
26 return 0;
27}

The documentation for this class was generated from the following files: