summaryrefslogtreecommitdiff
path: root/lib/ReadJob.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ReadJob.cc')
-rw-r--r--lib/ReadJob.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc
index 6851f0e..33f78dd 100644
--- a/lib/ReadJob.cc
+++ b/lib/ReadJob.cc
@@ -34,22 +34,31 @@ ReadJob::ReadJob(Handle * as, Handle * ad, const Regex & aregex) : s(as), d(ad),
ReadJob::~ReadJob() { }
int ReadJob::Do() throw (GeneralException) {
- String buff;
-
+ String ubuff;
+
switch (current) {
case 0:
try {
- *s >> buff;
+ if (buff.strlen() == 0) {
+ *s >> buff;
+ } else {
+ *s >> ubuff;
+ }
}
catch (IOAgain e) {
+ if (ubuff.strlen() != 0)
+ buff = buff + ubuff;
WaitFor(s, W4_READING);
Suspend(TASK_ON_HOLD);
}
+ if (ubuff.strlen() != 0)
+ buff = buff + ubuff;
case 1:
try {
*d << buff << "\n";
}
catch (IOAgain e) {
+ /***TODO*** Potential bug here: if the write was partial, we'd need to restart at a later position. */
current = 1;
WaitFor(d, W4_WRITING);
Suspend(TASK_ON_HOLD);