[Lazarus] How can a program executing a command via TProcess detect an input prompt and create a graphical dialog for the input?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Jan 2 10:09:17 CET 2013


Michael Van Canneyt wrote:
> On Tue, 1 Jan 2013, Frank Church wrote:
> 
>>
>> How can a Lazarus/FPC program that is executing a command via TProcess 
>> detect an input prompt and create a graphical dialog for the input?
>>
>> e.g. say I execute an ssh command via TProcess which requires a 
>> password to be input - how could it detect it, prompt for it with a 
>> graphical dialog and pass
>> it on for the command to continue?
> 
> There is no way to do this in general.
> 
> There are some unix tools that attempt to do this ('expect'), but all of 
> them require some form of script, taylored to the tools that you want to 
> use it for.

Considering the particular case of SSH, I think there's a related daemon 
which can detect whether sshd is asking for a passphrase and present a 
dialog(ue). I've not used it, and can't remember the extent to which it 
e.g. worked across networked systems.

I think the question needs to be clarified: would the requirement be 
better served by (a) finding some way for an alternative daemon or API 
to display the prompt or (b) investigating how to hook the TProcess 
child's request for input.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list