peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.61k stars 238 forks source link

Custom subprocess integration #358

Closed brd002 closed 1 year ago

brd002 commented 1 year ago

Hi, I have a library function that runs a shell command via subprocess.Popen and print dots if command is executed but ouputs nothing to stdout. To run an interactive shell command, i use terminal.py. But this example also uses subprocess. Is there a way to integrate the library function and example code using the built in ascimatics function, or maybe you can give me some advice if possible?

peterbrittain commented 1 year ago

Hmmm... Libraries shouldn't really make assumptions about the environment like that.

My guess is that the easiest thing to do would be to run the shell command directly. If you have to use the library, you need to explain better what is wrong. Printing dots is putting stuff to stdout (in the parent process). I assume that this is deliberate and the library is purposely doing it while swallowing any stdout from the child.

Sounds to me like you want the child stdout, but the library doesn't give you access to it. If so, I'm afraid you have to change the library.

brd002 commented 1 year ago

Thank you for your answer, i suppose the library should be changed.