texec2.pp 540 B

12345678910111213141516171819202122232425262728293031
  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. // cleanup
  18. // test illegal command
  19. try
  20. ExecuteProcess('afsdfdas',cmdline)
  21. except
  22. // unknown command should raise an exception
  23. halt(0);
  24. end;
  25. // we should never get here
  26. halt(1);
  27. end.