Well, I follow your instruction and receive the ExitStatus = 64.
I have a new question. I force an wrong line of tarball in the
konsole and receive 2 or 3 lines of message. Then I force my program
to repeat this wrong line and receive no lines back via TProcess.Output.
In the end of this e-mail I'll attach the procedure that tries to do
the job. May you take a look and try to discover why I don't receive
the error lines that I show in the screen when I type the command
direct in the konsole screen? The linux is 2KB in length, but the
lines I receive don't use 2KB.
This is text that appears in the listbox after I run the program:
+++ List of Files Processed by TAR +++
There were error(s). Processing return code = 64
Total of files stored = 0
Regards
Ricardo
procedure TfrmDataCompress.btnExecClick(Sender: TObject);
var command_line : string;
i,j : integer;
MsgsDeExecucao : TStringList;
begin
MsgsDeExecucao := TStringList.Create;
command_line := IfThen (rbZip.Checked,'zip ','tar ');
if not rbZip.Checked then // Use tarball
begin;
// AppendStr (command_line,IfThen
(rbTarOnly.Checked,'-cvf','-zcvf') + ' ');
AppendStr (command_line,IfThen
(rbTarOnly.Checked,'-avtf','-zatvf') + ' ');
if cbInclSubDir.Checked then
AppendStr (command_line,'--recursion ');
end
else
if cbInclSubDir.Checked then // Use ZIP
AppendStr (command_line,'-r ')
else;
// AppendStr (command_line,'--recurse ');
AppendStr (command_line,sdPackedFile.FileName);
j := lbListOfFilesToPack.Items.Count - 1;
For i := 0 to j do
AppendStr (command_line,' ' + lbListOfFilesToPack.Items [i]);
Process1.CommandLine := command_line;
Process1.Options := Process1.Options + [poWaitOnExit,poUsePipes];
ShowMessage (Process1.CommandLine);
Process1.Execute;
// ShowMessage (IntToStr (Process1.ExitStatus));
j := Process1.ExitStatus;
MsgsDeExecucao.LoadFromStream (Process1.Output);
lbListOfFilesToPack.Clear;
lbListOfFilesToPack.Items.Add ('+++ List of Files Processed by ' +
IfThen (rbZip.Checked,'ZIP',IfThen
(rbTarOnly.Checked,'TAR','TAR GZ')) + ' +++');
if j <> 0 then
lbListOfFilesToPack.Items.Add ('There were error(s). Processing
return code = ' +
IntToStr (j));
lbListOfFilesToPack.Items.Add (DupeString (' ',18) + 'Total of
files stored = ' +
IntToStr (MsgsDeExecucao.Count));
lbListOfFilesToPack.Items.AddStrings (MsgsDeExecucao);
MsgsDeExecucao.Destroy;
end;