Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-01

TProcess.NumBytesAvailable

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

Hi,

TAsyncProcess from the LCL has a property NumBytesAvailable. Attached patch adds it to TProcess in the FCL.

NumBytesAvailable checks how many bytes are available in TProcess.Output, so you can decide not to read from it if there are no bytes available.

Maybe you want a different name for the property or different implementation details. If so, let it know, so I can adapt the patch.

Vincent

Reply by email

Jonas Maebe
to Vincent Snijders
Vincent Snijders wrote 5 lines
+{$ifdef BSD} +const + FIONREAD = $4004667F; +{$endif} +

The FIONREAD constant is available in the termio units of both Darwin and FreeBSD as of 2.0.4 (not for Open/NetBSD, but that's probably the least of the things which need to be changed to get those platforms going again).

Jonas

Reply by email

Marc Weustink
to Vincent Snijders: TAsyncProcess from the LCL has a property NumBytesAvailable. Attached patch adds it to…
Vincent Snijders wrote 8 lines
Hi, TAsyncProcess from the LCL has a property NumBytesAvailable. Attached patch adds it to TProcess in the FCL. NumBytesAvailable checks how many bytes are available in TProcess.Output, so you can decide not to read from it if there are no bytes available.

What about StdErr output ?

Cant this be a property of the TInputPipeStream ?

Marc

Reply by email

Vincent Snijders
to Marc Weustink
Marc Weustink wrote 15 lines
Vincent Snijders wrote: > Hi, > > TAsyncProcess from the LCL has a property NumBytesAvailable. Attached > patch adds it to TProcess in the FCL. > > NumBytesAvailable checks how many bytes are available in > TProcess.Output, so you can decide not to read from it if there are > no bytes available. What about StdErr output ? Cant this be a property of the TInputPipeStream ?

Seems like an good idea. I will create a new patch.

Jonas Maebe wrote 5 lines
The FIONREAD constant is available in the termio units of both Darwin and FreeBSD as of 2.0.4 (not for Open/NetBSD, but that's probably the least of the things which need to be changed to get those platforms going again).

Thanks for the hint. I guess this was not yet the case when TAsyncProcess was written by Micha.

Vincent

Reply by email

Vincent Snijders
to Vincent Snijders
Vincent Snijders wrote 28 lines
Marc Weustink schreef: > Vincent Snijders wrote: >> Hi, >> >> TAsyncProcess from the LCL has a property NumBytesAvailable. Attached >> patch adds it to TProcess in the FCL. >> >> NumBytesAvailable checks how many bytes are available in >> TProcess.Output, so you can decide not to read from it if there are >> no bytes available. > > What about StdErr output ? > > Cant this be a property of the TInputPipeStream ? > > Seems like an good idea. I will create a new patch. Jonas Maebe schreef: > > The FIONREAD constant is available in the termio units of both Darwin > and FreeBSD as of 2.0.4 (not for Open/NetBSD, but that's probably the > least of the things which need to be changed to get those platforms > going again). Thanks for the hint. I guess this was not yet the case when TAsyncProcess was written by Micha.

Attached is a new patch.

I didn't how to implement this for OS/2.

If the CreatePipes function was not implemented, I assume that poUsePipes cannot be used. GetNumBytesAvailable returns 0 is such cases.

Vincent

Reply by email

Michael Van Canneyt
to Vincent Snijders
Vincent Snijders wrote 36 lines
Vincent Snijders schreef: > Marc Weustink schreef: > > Vincent Snijders wrote: > > > Hi, > > > > > > TAsyncProcess from the LCL has a property NumBytesAvailable. Attached > > > patch adds it to TProcess in the FCL. > > > > > > NumBytesAvailable checks how many bytes are available in > > > TProcess.Output, so you can decide not to read from it if there are no > > > bytes available. > > > > What about StdErr output ? > > > > Cant this be a property of the TInputPipeStream ? > > > > > > Seems like an good idea. I will create a new patch. > > Jonas Maebe schreef: > > > > The FIONREAD constant is available in the termio units of both Darwin > > and FreeBSD as of 2.0.4 (not for Open/NetBSD, but that's probably the > > least of the things which need to be changed to get those platforms > > going again). > > Thanks for the hint. I guess this was not yet the case when TAsyncProcess > was written by Micha. Attached is a new patch. I didn't how to implement this for OS/2. If the CreatePipes function was not implemented, I assume that poUsePipes cannot be used. GetNumBytesAvailable returns 0 is such cases.

Patch applied. Revision 6275.

Michael.

Reply by email