PgmResult.cc 863 Bytes
/*
 * 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 */