File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,14 @@ async function run(): Promise<void> {
2020 new EmailSender ( ) ) ;
2121
2222 const mailSent = await reportManager . sendReportAsync ( reportConfiguration ) ;
23- console . log ( "Email Task processing complete. Setting EmailReportTask.EmailSent Variable value." ) ;
24- // Wait for 10 sec and timeout
25- let val = await Promise . race ( [ sleep ( 10000 ) , setEmailSentVariable ( mailSent ) ] ) ;
26- if ( ! val ) {
27- console . log ( "Unable to set variable value in 10 sec. Exiting task." ) ;
23+ if ( mailSent ) {
24+ // Wait for 10 sec and timeout
25+ let val = await Promise . race ( [ sleep ( 10000 ) , setEmailSentVariable ( mailSent ) ] ) ;
26+ if ( ! val ) {
27+ console . log ( "Unable to set variable value in 10 sec. Exiting task." ) ;
28+ }
2829 }
30+ console . log ( "Task Processing Complete." ) ;
2931 }
3032 catch ( err ) {
3133 if ( err instanceof ReportError ) {
@@ -41,7 +43,9 @@ function sleep(ms: number): Promise<boolean> {
4143}
4244
4345async function setEmailSentVariable ( mailSent : boolean ) : Promise < boolean > {
46+ console . log ( "Setting EmailReportTask.EmailSent Variable value." ) ;
4447 console . log ( `##vso[task.setvariable variable=EmailReportTask.EmailSent;]${ mailSent } ` ) ;
48+ console . log ( `EmailReportTask.EmailSent Variable value set as ${ mailSent } ` ) ;
4549 return true ;
4650}
4751
You can’t perform that action at this time.
0 commit comments