help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to assert user input to fifo to then read from it


From: Alex fxmbsw7 Ratchev
Subject: Re: how to assert user input to fifo to then read from it
Date: Thu, 25 Aug 2022 14:46:53 +0200

On Thu, Aug 25, 2022, 14:45 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:

>
>
> On Thu, Aug 25, 2022, 14:27 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
> wrote:
>
>>
>>
>> On Thu, Aug 25, 2022, 13:32 Greg Wooledge <greg@wooledge.org> wrote:
>>
>>> On Thu, Aug 25, 2022 at 11:36:11AM +0200, Alex fxmbsw7 Ratchev wrote:
>>> > im doing some apt update cmds script
>>> > in there i realized i need detached input for , when as dedicated auto
>>> > updater used , a question appears , to answer this
>>> > ( seeing by log then reacting to via printf to fifo , and checking
>>> then log
>>> > further )
>>> >
>>> > the script yet is attached
>>> > the in question is line 20 , it does exec <"$fi"
>>> > .. and my question is what previously to exec to put scripts stdin (
>>> may
>>> > not be tty .. ? ) into that fifo , then that the exec < that_fifo
>>> >
>>> > understood halfways ?
>>>
>>> If we remove the FIFO from the equation, it sounds like you want to
>>> inject some scripted data into the terminal's input buffer.
>>>
>>
>> i try an auto updater, that prints to stdout and tee -a logfile
>> that autoupdater be run via sysvinit , and ( dennis hinted it out ,
>> noninteractive something , but i need this code)
>> but the idea is run dedicated autoupdater , and have coded the
>> possibility that when it hangs on dpkg question, via fifo to input to it
>>
>> i learnt roughly only fifos will work for intercomm
>>
>> and in that, i figured, i need the code to delegate user input to fifo ,
>> which then gets to be stdin of the runtime
>>
>> .. script start , put to-script fd to fifo , and set scripts stdin fd be
>> from that fifo
>>
>> i can imagine , exec <fifo , ( apt dpkg commands
>> ..<abort>
>> a cat >fifo be foreground process
>> while apt dpkg commands run in background , or coproc
>>
>> .. complicated
>>
>
> i think something in the direction might work
>
> script starts , exec > tee log , mkfifo fi , start coproc with the chain
> apt cmds, with input from fifo
> and finally, a cat >fi foreground .. .. .. ?
>

the coproc may be even omitted
just harder must think


>
>> thanks much !
>>
>> There's this:
>>>
>>> greg@remote:/home/greybot/factoids$ cat tiocsti ; echo
>>> The TIOCSTI ioctl() command lets you insert input into a terminal
>>> driver's queue. "Simulate Terminal Input".
>>>
>>> If you can do the injection in C, you can use that.
>>>
>>> Otherwise, maybe you can do something with tmux or screen?  I don't know
>>> those programs well enough.
>>>
>>> Or if all else fails, there's always Expect.
>>>
>>>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]