Blame view

test/DD_Client/CSlimFixtures/PgmResult.cc 863 Bytes
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * PgmResult.cc
 *
 *  Created on: Jan 10, 2013
 *      Author: f.casimir
 */
#include <unistd.h>
#include <string>

#include "PgmResult.hh"

namespace AMDA {
namespace CSlimFixtures {

PgmResult::PgmResult() : _result(0) {
	char lOutFile[] = "/tmp/amdaTestOutput.XXXXXX";
	close( mkstemp(lOutFile));
	_stdOutFile = std::string(lOutFile);
	char lErrFilr[] = "/tmp/amdaTestOutput.XXXXXX";
	close( mkstemp(lErrFilr));
    _stdErrFile = std::string(lErrFilr);
}

PgmResult::~PgmResult() {
    remove(_stdOutFile.c_str());
    remove(_stdErrFile.c_str());
}

void PgmResult::displayStdErr() {
	std::string command = std::string("cat ") + _stdErrFile + ">&2";
	system(command.c_str());
}

void PgmResult::displayStdOut() {
	std::string command = std::string("cat ") + _stdOutFile;
	system(command.c_str());
}

} /* namespace CSlimFixtures */
} /* namespace AMDA */