Belle II Software
release-05-01-25
CommandLine.cc
1
//+
2
// File : CommandLine.cc
3
// Description : Run external shell
4
//
5
// Author : Ryosuke Itoh, IPNS, KEK
6
// Date : 25 - Mar - 2020
7
//-
8
9
#include "daq/slc/system/CommandLine.h"
10
11
using namespace
Belle2
;
12
using namespace
std;
13
14
int
CommandLine::run_shell(
const
string
& cmdline,
string
& response)
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
}
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
daq
slc
system
src
CommandLine.cc
Generated on Fri Nov 5 2021 03:50:15 for Belle II Software by
1.8.17