aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_environment.f90
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-11-22 16:08:47 +0000
committerLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-11-22 16:22:25 +0000
commit2654623adea742b2e10a85aa90706f20f8b87b88 (patch)
tree4b68f3522aefc0ea86b7764cd8c9a6a63d761b18 /src/fpm_environment.f90
parentd9520ce7ca433c94d4309ee834c0d4494652c4d0 (diff)
downloadfpm-2654623adea742b2e10a85aa90706f20f8b87b88.tar.gz
fpm-2654623adea742b2e10a85aa90706f20f8b87b88.zip
Update: run command with optional verbose argument
Diffstat (limited to 'src/fpm_environment.f90')
-rw-r--r--src/fpm_environment.f9028
1 files changed, 23 insertions, 5 deletions
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