Skip to content

PRT061 non-portable-system-call ​

warning opt-in

system() (a compiler extension) runs a shell command.

Why ​

The standard execute_command_line (Fortran 2008) runs a command portably and reports its status.

Reported ​

fortran
call system('mkdir -p out')

Preferred ​

fortran
call execute_command_line('mkdir -p out', exitstat=status)

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[PRT061] <why this occurrence is fine>

For the whole project, ignore = PRT061 in the fobos [lint] section.

Equivalent ​

Fortitude rule PORT061 (see Lint Rules).