@@ -297,6 +297,7 @@ subroutine cmd_run(settings,test)
297297 type (build_target_t), pointer :: exe_target
298298 type (srcfile_t), pointer :: exe_source
299299 integer :: run_scope
300+ integer , allocatable :: stat(:)
300301 character (len= :),allocatable :: line
301302 logical :: toomany
302303
@@ -417,18 +418,31 @@ subroutine cmd_run(settings,test)
417418 call compact_list()
418419 else
419420
421+ allocate (stat(size (executables)))
420422 do i= 1 ,size (executables)
421423 if (exists(executables(i)% s)) then
422424 if (settings% runner .ne. ' ' )then
423- call run(settings% runner// ' ' // executables(i)% s// " " // settings% args,echo= settings% verbose)
425+ call run(settings% runner// ' ' // executables(i)% s// " " // settings% args, &
426+ echo= settings% verbose, exitstat= stat(i))
424427 else
425- call run(executables(i)% s// " " // settings% args,echo= settings% verbose)
428+ call run(executables(i)% s// " " // settings% args,echo= settings% verbose, &
429+ exitstat= stat(i))
426430 endif
427431 else
428432 write (stderr,* )' fpm::run<ERROR>' ,executables(i)% s,' not found'
429433 stop 1
430434 end if
431435 end do
436+
437+ if (any (stat /= 0 )) then
438+ do i= 1 ,size (stat)
439+ if (stat(i) /= 0 ) then
440+ write (* ,* ) ' <ERROR> Execution failed for "' ,basename(executables(i)% s),' "'
441+ end if
442+ end do
443+ stop 1
444+ end if
445+
432446 endif
433447 contains
434448 subroutine compact_list_all ()
0 commit comments