Can't get output from an external command lazarus / 8-Other ---------------------------------------------------------------------- glober · 2005-12-11 19:14 I have the following:Code: [Select] begin   AProcess := TProcess.Create(nil);   AStringList := TStringList.Create;   AProcess.CommandLine := 'cp afile /opt/afile';   AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];   AProcess.Execute;   AStringList.LoadFromStream(AProcess.OutPut);   ShowMessage(AStringList.Text);   AStringList.SaveToFile('output.txt');   AStringList.Free;   AProcess.Free; end; As a test "afile" is being copied to a permission denied directory, and doesn't get copied but the ShowMessage or output.txt doesn't show any error message. :? Why doesn't it work? ---------------------------------------------------------------------- Marc · 2005-12-12 14:23 probably becouse an error is written to stderr and not to stdout. If you want to handle this all in one stream, use poStderrToOutPut in the process options. Otherwise, read from the StdErr stream ---------------------------------------------------------------------- glober · 2005-12-13 02:41 Quote from: "Marc"probably becouse an error is written to stderr and not to stdout. If you want to handle this all in one stream, use poStderrToOutPut in the process options. Otherwise, read from the StdErr stream Yes, both suggestions work. It's easy when one knows   . Thankyou