Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: bi-directional stdin/stdout communication interface #450

Open
prusnak opened this issue Feb 6, 2021 · 3 comments
Open

Proposal: bi-directional stdin/stdout communication interface #450

prusnak opened this issue Feb 6, 2021 · 3 comments

Comments

@prusnak
Copy link
Collaborator

prusnak commented Feb 6, 2021

Currently the communication with HWI goes like this:

exec hwi enumerate
read from stdout [ list of devices in json ]

exec hwi -t device command arguments
read from stdout ... json response ...

While this might be a better match:

exec hwi enumerate
read from stdout [ list of devices in json ]

exec hwi -t device connect
write to stdin { "command" : "command1", "args": { "arg1": "...", "arg2" : "...", ... } }
read from stdout { json response }
write to stdin { "command" : "command2", "args": { "arg1": "...", "arg2" : "...", ... } }
read from stdout { json another response }

Or even:

exec hwi
write to stdin { "command": "enumerate" }
read from stdout [ list of devices in json ]
write to stdin { "command" : "command1", "args": { "arg1": "...", "arg2" : "...", ... } }
read from stdout { json response }
write to stdin { "command" : "command2", "args": { "arg1": "...", "arg2" : "...", ... } }
read from stdout { json another response }

This would enable us to add so badly needed sessions into HWI and these sessions will exist only on memory, so we don't need to ponder how to store them on the filesystem. Having this would allow us to fix issues #326 or #447 easily without any hacks.

@achow101
Copy link
Member

achow101 commented Feb 6, 2021

We have an --interactive switch where this could be implemented.

However I dislike the idea of having HWI be a pseudo-shell like that. For downstream consumers, they have to spawn another thread just to keep HWI running and then communicate with it asynchronously and that is kind of annoying to do. Perhaps @molnard, @nopara73, and @NicolasDorier could pitch in with what they would prefer?

@NicolasDorier
Copy link

well on my side we just use the program with proper args and read the output. This is good enough for what we want to do, so I don't expect changing this.

@molnard
Copy link
Contributor

molnard commented Feb 12, 2021

I prefer the current design. If it is possible to solve this by adding a new parameter to the call like a "session key", that would be an optimal solution.
#326 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants