Skip to content

Commit 2ada9fa

Browse files
committed
start example directory
1 parent 1075f02 commit 2ada9fa

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

example/demo_run.f90

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
program demo_run
2+
use fpm_filesystem, only: run
3+
implicit none
4+
integer :: exitstat
5+
character(len=:), allocatable :: cmd
6+
logical, parameter T = .true., F = .false.
7+
cmd = 'ls -ltrasd *.md'
8+
9+
call run(cmd)
10+
call paws('default options (ie. echo=T verbose=T)')
11+
12+
call run(cmd, exitstat=exitstat)
13+
write (*, *) 'exitstat=', exitstat
14+
call paws('exitstat')
15+
16+
call run(cmd, echo=F)
17+
call paws('echo=F')
18+
19+
call run(cmd, verbose=F)
20+
call paws('verbose=F')
21+
22+
call run(cmd, verbose=F, echo=F)
23+
call paws('verbose=F echo=F')
24+
25+
call run(cmd, redirect='_scratch')
26+
call paws('redirect="_scratch"')
27+
28+
call run(cmd, redirect='_scratch', verbose=F)
29+
call paws('redirect="_scratch" verbose=F')
30+
31+
call run(cmd, redirect='_scratch', verbose=T)
32+
call paws('redirect="_scratch" verbose=T')
33+
34+
contains
35+
36+
subroutine paws(str)
37+
character(len=*), intent(in) :: str
38+
character(len=1) :: chr
39+
integer :: iostat
40+
41+
write (*, '(a,": ")', advance='no') str
42+
read (*, '(a)', iostat=iostat) chr
43+
write (*, '(a)') repeat('-', 60)
44+
45+
end subroutine paws
46+
47+
end program demo_run

0 commit comments

Comments
 (0)