#ifdef WIN32
string fileName = generateTemporaryFileName(prefix);
- outputStream.open(fileName.c_str());
+ // Open the file as binary to avoid problems with Windows newlines
+ outputStream.open(fileName.c_str(), ios_base::binary | ios_base::out);
#else
// Wait for the end of the job
string state = bm->waitForJobEnd(jobid, timeout);
- if (state == FINISHED || state == FAILED) {
+ if (state == FINISHED) {
cout << "Job " << jobid.__repr__() << " is done" << endl;
bm->importOutputFiles(job, "resultdir/seconddirname");
+ } else if (state == FAILED) {
+ cerr << "Job " << jobid.__repr__() << " finished in error" << endl;
+ bm->importOutputFiles(job, "resultdir/seconddirname");
+ return 1;
} else {
cerr << "Timeout while executing job" << endl;
return 1;