Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001393 [JEDI VCL] 00 JVCL Components major always 2004-02-29 12:29 2005-08-10 01:16
Reporter anonymous View Status public  
Assigned To remkobonte
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0001393: TJvCreateProcess cannot capture all output
Description To reproduce this error
1) compile a simple delphi console app. only with
  "for i:= 0 to 100 do writeln('not captured');" statement

2) Create a new application and drop a jvCreateProcess on form, drop a memo and Set the OnRead event to update this memo and drop a button to start process.

3) set commandline of jvCreateProcess to that simple console app also include coRedirect flag to ConsoleOptions
  
4) now run it and get no output.
  
5) I was able get some part of the output by
   1) setting cfSuspended in CreationFlags to true
   2) Change Button's click handler to
        jvprocess.run;
        Sleep(100);
        ResumeThread(JvProcess.ProcessInfo.hThread);
   3) Now I get partial (amount changes randomly each ime)
   
  
Additional Information
Tags No tags attached.
Attached Files zip file icon ELEEYE09.zip [^] (58,972 bytes) 2005-06-26 04:57

- Relationships
has duplicate 0002256resolvedremkobonte TJvCreateProcess.ConsoleOutput is empty 

-  Notes
(0003122)
AHUser (developer)
2004-02-29 12:52

Till this is fixed you meight have a look at Install\JVCL3Install\CapExec.pas

Because I'm writing a new installer at the moment, someone else may fix this bug.
(0003126)
anonymous (viewer)
2004-02-29 22:54

Ok, I got a quick and dirty fix but I dont think trusting Sleep func. is good

  1) setting cfSuspended in CreationFlags to true
  2) Change Button's click handler to
        jvprocess.run;
        ResumeThread(JvProcess.ProcessInfo.hThread);
        Sleep(100);
  3) now I get all output
(0003128)
user72
2004-03-01 01:45

Is the ResumeThread/Sleep fix a generic solution or is it specific to your use of it or can it b eused only with cfSuspended? If it is a generic solution, it should be added to TJvCreateProcess directly, IMO.
(0003129)
remkobonte (developer)
2004-03-01 03:17
edited on: 2004-03-01 03:19

I cannot reproduce it with JVCL3;Delphi7;Windows XP.

Maybe you did use Write instead of WriteLn?

edited on: 03-01-04 03:19
(0003131)
user72
2004-03-01 05:48

According to the example in "Description", he used writeln
(0003132)
anonymous (viewer)
2004-03-01 08:45

Yes I used WriteLn, also even if Write used, the unsent buffer will trigger OnRead before process termination.

And Peter, in my case "sleep(100)" was OK but that amount may change from user to user so I dont think it is agood idea, maybe I can study CapExec.pas and apply necessary changes to TJvCreateProcess at this weekend.
(0003134)
remkobonte (developer)
2004-03-01 09:56

Do you have windows 95,98,Me?
(0003137)
anonymous (viewer)
2004-03-01 10:42

No, I use win2000 SP4
(0003139)
remkobonte (developer)
2004-03-01 11:09

Delphi7? JVCL3? Extreme fast/slow computer?

Just guessing, because I can't reproduce it <g>

Can someone else reproduce it?
(0003140)
utku karatas (reporter)
2004-03-01 11:15

Yes Delphi7, JVCL3 and a Athlon 2000 + Win2k SP4
I can reproduce it in any fast finishing executable
(0003144)
remkobonte (developer)
2004-03-01 13:20

Okay switch the creation code of the read thread and the wait thread in procedure TJvCreateProcess.Run. Thus it will be something like:

procedure TJvCreateProcess.Run;
[..]
   if DoRedirect then
    begin
      FReadThread := TJvReadThread.Create(LLocalHandles.Read, Handle);
      FReadThread.OnTerminate := ReadThreadOnTerminate;
      FReadThread.Resume;

      FWaitThread := TJvConsoleThread.Create(FProcessInfo.hProcess,
        LLocalHandles.Write);
      FWaitThread.OnTerminate := WaitThreadOnTerminate;
      FWaitThread.Resume;

      FState := psWaiting;
    end
[..]
(0003591)
user72
2004-04-02 10:58

Remko, have you updated this in CVS? Can we close this report?
(0003634)
remkobonte (developer)
2004-04-04 13:45

I've changed it a bit, but wasn't completely happy with it. I didn't close the report, so I would not forget to think about it <g>.

I'll close it this week.
(0003977)
remkobonte (developer)
2004-04-21 12:54

Fixed in rev 1.16
(0007492)
anonymous (viewer)
2005-06-26 03:59
edited on: 2005-06-26 04:02

I still only get partial message in ELEEYE09.exe (I am using Jvcl v3.0 (JvCreateProcess.pas v1.26) Delphi 7 winxp sp1
http://home.i-cable.com/wu/ELEEYE09.zip [^] (I enclosed the error picture)
(Please delete [^] in the url)

The reproduce procedure:
ucci
position startpos
go depth 7.

The partial message output of "go depth 7" are
Only to "Info depth 4 ...."

(0007493)
sum (reporter)
2005-06-26 04:06
edited on: 2005-06-26 14:43

1 I may delete the file in some day so that I attach to here
2 I forget to say that the program exit command: quit

edit:Now see attached file

(0007716)
obones (administrator)
2005-08-09 06:54

Remko, any news ?
(0007753)
remkobonte (developer)
2005-08-09 16:13

I can reproduce the problem, but my guess is that the problem is in the ELEEYE09.exe.

I tried ELEEYE09.exe with three other programs that redirect the input and they all showed the same behaviour.

It seems that ELEEYE09.exe does not flush the output, so it locks up.
(0007754)
obones (administrator)
2005-08-10 01:16

Ok then I'm marking it as resolved.

- Issue History
Date Modified Username Field Change
2004-02-29 12:29 anonymous New Issue
2004-02-29 12:52 AHUser Note Added: 0003122
2004-02-29 22:54 anonymous Note Added: 0003126
2004-03-01 01:45 user72 Note Added: 0003128
2004-03-01 03:17 remkobonte Note Added: 0003129
2004-03-01 03:19 remkobonte Note Edited: 0003129
2004-03-01 05:48 user72 Note Added: 0003131
2004-03-01 08:45 anonymous Note Added: 0003132
2004-03-01 09:56 remkobonte Note Added: 0003134
2004-03-01 10:15 user72 Status new => feedback
2004-03-01 10:42 anonymous Note Added: 0003137
2004-03-01 11:09 remkobonte Note Added: 0003139
2004-03-01 11:15 utku karatas Note Added: 0003140
2004-03-01 13:20 remkobonte Note Added: 0003144
2004-03-30 23:41 ogiesen Issue Monitored: ogiesen
2004-04-02 10:58 user72 Note Added: 0003591
2004-04-04 13:45 remkobonte Note Added: 0003634
2004-04-21 12:54 remkobonte Status feedback => resolved
2004-04-21 12:54 remkobonte Resolution open => fixed
2004-04-21 12:54 remkobonte Assigned To => remkobonte
2004-04-21 12:54 remkobonte Note Added: 0003977
2004-10-21 11:11 remkobonte Relationship added has duplicate 0002256
2005-06-26 03:52 sum Issue Monitored: sum
2005-06-26 03:52 sum Issue End Monitor: sum
2005-06-26 03:56 sum Issue Monitored: sum
2005-06-26 03:59 anonymous Status resolved => feedback
2005-06-26 03:59 anonymous Resolution fixed => reopened
2005-06-26 03:59 anonymous Note Added: 0007492
2005-06-26 04:02 anonymous Note Edited: 0007492
2005-06-26 04:06 sum Note Added: 0007493
2005-06-26 04:10 sum Note Edited: 0007493
2005-06-26 04:57 remkobonte File Added: ELEEYE09.zip
2005-06-26 14:42 sum Note Edited: 0007493
2005-06-26 14:43 sum Note Edited: 0007493
2005-08-09 06:54 obones Note Added: 0007716
2005-08-09 16:13 remkobonte Note Added: 0007753
2005-08-10 01:16 obones Status feedback => resolved
2005-08-10 01:16 obones Resolution reopened => fixed
2005-08-10 01:16 obones Note Added: 0007754


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker