texec2.pp 527 B

123456789101112131415161718192021222324252627282930
  1. {$mode objfpc}
  2. {$h+}
  3. Uses Sysutils;
  4. var cmd,cmdline : String;
  5. i : Longint;
  6. begin
  7. {$ifdef unix}
  8. cmd:='./texec1';
  9. {$else}
  10. cmd:='texec1.exe';
  11. {$endif}
  12. cmdline:='';
  13. for i:=0 to 10 do
  14. cmdline:=cmdline+'-Fu/usr/local/lib/fpc/1.0.10/units/freebsd/rtl/* ';
  15. if ExecuteProcess(cmd,cmdline)<>0 Then
  16. halt(1);
  17. // test illegal command
  18. try
  19. ExecuteProcess('afsdfdas',cmdline)
  20. except
  21. // unknown command should raise an exception
  22. halt(0);
  23. end;
  24. // we should never get here
  25. halt(1);
  26. end.