|
@@ -69,6 +69,7 @@ int monojob_wait ( const char *string, unsigned long timeout ) {
|
69
|
69
|
unsigned long total;
|
70
|
70
|
unsigned int percentage;
|
71
|
71
|
int shown_percentage = 0;
|
|
72
|
+ int ongoing_rc;
|
72
|
73
|
int key;
|
73
|
74
|
int rc;
|
74
|
75
|
|
|
@@ -97,10 +98,13 @@ int monojob_wait ( const char *string, unsigned long timeout ) {
|
97
|
98
|
last_keycheck = now;
|
98
|
99
|
}
|
99
|
100
|
|
|
101
|
+ /* Monitor progress */
|
|
102
|
+ ongoing_rc = job_progress ( &monojob, &progress );
|
|
103
|
+
|
100
|
104
|
/* Check for timeout, if applicable */
|
101
|
105
|
elapsed = ( now - start );
|
102
|
106
|
if ( timeout && ( elapsed >= timeout ) ) {
|
103
|
|
- monojob_rc = -ETIMEDOUT;
|
|
107
|
+ monojob_rc = ( ongoing_rc ? ongoing_rc : -ETIMEDOUT );
|
104
|
108
|
break;
|
105
|
109
|
}
|
106
|
110
|
|
|
@@ -109,7 +113,6 @@ int monojob_wait ( const char *string, unsigned long timeout ) {
|
109
|
113
|
if ( string && ( elapsed >= TICKS_PER_SEC ) ) {
|
110
|
114
|
if ( shown_percentage )
|
111
|
115
|
printf ( "\b\b\b\b \b\b\b\b" );
|
112
|
|
- job_progress ( &monojob, &progress );
|
113
|
116
|
/* Normalise progress figures to avoid overflow */
|
114
|
117
|
completed = ( progress.completed / 128 );
|
115
|
118
|
total = ( progress.total / 128 );
|