program p
integer :: i
callexecute_command_line("x a b", exitstat=i)
print *, "Exit status of x was ", i
callexecute_command_line("x a b", wait=.false.)
print *, "running x in the background"endprogram p
import"os/exec"
err := exec.Command("x", "a", "b").Run()
x's output is ignored. To access it, see (*Cmd).Output, (*Cmd).StdoutPipe, etc.
var
p: tprocess;
begin
p.Executable := 'program_x';
p.Parameters.Add('a');
p.Parameters.Add('b');
p.Execute;
end.
tprocess is specific to freepascal and offers a cross-platform solution to this problem. In Delphi use shellexecute(), which is a windows only solution.
program p
integer :: i
call execute_command_line("x a b", exitstat=i)
print *, "Exit status of x was ", i
call execute_command_line("x a b", wait=.false.)
print *, "running x in the background"
end program p