Kaynağa Gözat

[monojob] Report ongoing job status as overall return status on timeout

If a job times out then use the most recent ongoing error status
reported via job_progress() (if available) as the overall return
status.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 yıl önce
ebeveyn
işleme
dc7a023715
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5
    2
      src/core/monojob.c

+ 5
- 2
src/core/monojob.c Dosyayı Görüntüle

@@ -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 );

Loading…
İptal
Kaydet