开发者

How to get an asynchronous ouput in a Python cmd shell?

开发者 https://www.devze.com 2023-02-27 02:56 出处:网络
I use the cmd module to create an interactive shell. The workflow is a usual one: enter command, print result. 开发者_JAVA技巧But the result will be processed asynchronously,then stacked in a queue.

I use the cmd module to create an interactive shell.

The workflow is a usual one: enter command, print result. 开发者_JAVA技巧But the result will be processed asynchronously,then stacked in a queue. I then need some way to get it back into my shell to display it.

How can I push data from ouside my shell into my shell and print it ? Should I use a pipe or a signal ? I have no clue.

I mainly need something that works underlinux but cross platform is always a nice to have.


If it's only for display purposes, you can just print the result to c.stdout (c is cmd.Cmd object). Will that work for you?

0

精彩评论

暂无评论...
验证码 换一张
取 消