Problem with Tprocess lazarus / 1-Linux ---------------------------------------------------------------------- ilikeit · 2007-04-13 16:41 Hello, In my program (lazarus 0.9.20, linux mandriva, gtk) I have this procedure: Code: [Select] procedure TMainForm.Exec(const cmd:string); var Aprocess: Tprocess; begin      try         AProcess := TProcess.Create(nil);         AProcess.CommandLine := cmd;         AProcess.Execute;      finally         AProcess.Free;      end; end; When I use a valid command line, it's OK. But when the command line is not valid (eg: Exec('toto') where toto is not a program), what's happen? Well, the program crash!!! I've tried to use try ... except, but it's always the same thing, the program crash... How can I do? Thanks. ---------------------------------------------------------------------- antonio · 2007-04-13 17:03 You could filter more the cmd values by FileExists and ExtractFileExt. ---------------------------------------------------------------------- ilikeit · 2007-04-13 17:09 Hi, It's not so simple, because in command line there is  a program, or a script, and parameters! I have tried this: Code: [Select] AProcess.CommandLine :='sh ./execute.sh '+cmd; (instead of: AProcess.CommandLine :=cmd;) where execute.sh is a script: Code: [Select] #!/bin/sh $1 It seems stupid but it works fine, even when the command line is not valid! Is it a bug in FPC? ---------------------------------------------------------------------- ilikeit · 2007-05-06 17:23 Well, Nobody knows this bug? ---------------------------------------------------------------------- antonio · 2007-05-06 17:37 You can search for a bug in BugTracker by http://www.freepascal.org/mantis/view_all_bug_page.php