From 2654623adea742b2e10a85aa90706f20f8b87b88 Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Mon, 22 Nov 2021 16:08:47 +0000 Subject: Update: run command with optional verbose argument --- src/fpm_environment.f90 | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fpm_environment.f90 b/src/fpm_environment.f90 index bcd9cb9..22094e5 100644 --- a/src/fpm_environment.f90 +++ b/src/fpm_environment.f90 @@ -158,22 +158,40 @@ contains end function os_is_unix !> echo command string and pass it to the system for execution - subroutine run(cmd,echo,exitstat) + subroutine run(cmd,echo,exitstat,verbose) character(len=*), intent(in) :: cmd logical,intent(in),optional :: echo integer, intent(out),optional :: exitstat - logical :: echo_local + logical, intent(in), optional :: verbose + logical :: echo_local, verbose_local integer :: stat + if(present(echo))then echo_local=echo else echo_local=.true. - endif - if(echo_local) print *, '+ ', cmd + end if + + if(present(verbose))then + verbose_local=verbose + else + verbose_local=.true. + end if - call execute_command_line(cmd, exitstat=stat) + if(echo_local) print *, '+ ', cmd + if(verbose_local)then + call execute_command_line(cmd, exitstat=stat) + else + if (os_is_unix()) then + write(*,*) "is_unix" + call execute_command_line(cmd//">/dev/null 2>&1", exitstat=stat) + else + call execute_command_line(cmd//">NUL 2>&1", exitstat=stat) + end if + endif + if (present(exitstat)) then exitstat = stat else -- cgit v1.2.3