Belle II Software development
CommandLine.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "daq/slc/system/CommandLine.h"
10
11using namespace Belle2;
12using namespace std;
13
14int 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}
Abstract base class for different kinds of events.
STL namespace.