jeremybernstein / shell

Max object: execute terminal commands on OSX and Windows
70 stars 7 forks source link

executing scripts with logouts too fast dont print out from the [shell] object #8

Open maybites opened 2 years ago

maybites commented 2 years ago

Hi Jeremy

and here another example, again with ultragrid (see https://github.com/jeremybernstein/shell/issues/7).


----------begin_max5_patcher----------
481.3ocoSEqaaCCDcVFv+CDbpAPJ1l1Vt0SEn.sqcISIAFzRWUX.Eo.4QGUD
z+8PQJYajHWXztHJ93c7t26d70oSRn60sfkR1Rtmjj7pGIIf0gjL.jPq4sER
tMDHUAun2+LMs+LDZw.diQnvivJWs1gR.CIMe.VTFh0eAYqOOVgZHzECnMbr
3IgpZmAJvXKtXy5ammRVtbQXg08k4+RdLjyelNoa0ujd0roFrVdE7Q57.8aa
m8SitxvqIeWHA6r6jng+Cin7zeYEZEJTNsyl8hPkuZl6vsPK7.kjYHMZCxck
B81m.YCIKqg2caRcUlRWnkZyw5JEJnP6TghyFWEOJMQL72MPTWnTxiinvqFW
gY+EElMOuSTWrYUPgymGW9uj3KYXrdQQR9pEKAi4BFG1kobJgtmqpFm5r+Yy
EKOXq17kSlqgjr7CP4N+06yYGGQiXuCiOeRNQ9jHwBsxmJgewcR7FZ7rd46L
YLd6gw+6eGF5wtCdm3Z0NSwfLzOmIm0lkf0aI4nPqNKHVLnKOEu5xwtlxsdz
x0yVdSyAvX6yHVIum4Y+6A+9OmF2KTw8Ki6MvAwPJQaAka7CQzOMblPCRay6
87zZs2UobhvT2izw0tRGrkJt+YeCOxpf8c5De.uAWOGLV.
-----------end_max5_patcher-----------

in this case the script is polling portaudio to get all the available devices. This works sometimes, but again not always,

the output should look like this:

print: UltraGrid 1.7+ (tags/continuous rev 39d62f9f built Sep 27 2022 14:13:09)
print: Display device : none
print: Capture device : none
print: Audio capture : none
print: Audio playback : portaudio:help
print: MTU : 9000 B
print: Video compression: none
print: Audio codec : PCM
print: Network protocol : UltraGrid RTP
print: Audio FEC : none
print: Video FEC : none

print: [PortAudio] Using PortAudio V19.7.0-devel, revision 147dd722548358763a8b649b3e4b41dfffbcfbb6
print: PortAudio playback usage:
print: -r poraudio[:<index>]
print: Available PortAudio playback devices:
print: portaudio - use default Portaudio device (marked with star)
print: portaudio:4 - Microsoft Sound Mapper - Output (output channels: 2 ; input channels: 0 ; MME)
print: (*) portaudio:5 - Speakers (Realtek(R) Audi
print: nput channels: 0 ; MME)
print: portaudio:6 - Headphones (Oculus Virtual Audi (output channels: 2 ; input channels: 0 ; MME)
print: portaudio:7 - Speakers (Logitech BT Adapter S (output channels: 2 ; input channels: 0 ; MME)
print: portaudio:8 - CABLE Input (VB-Audio Virtual C (output channels: 8 ; input channels: 0 ; MME)
.....
..... 20 more lines
.....
print: portaudio:53 - Headset Earphone (HyperX Virtual Surround Sound) (output channels: 2 ; input channels: 0 ; Windows WDM-KS)
print: Exit

but on this machine after a few tries it looks like this:

print: UltraGrid 1.7+ (tags/continuous rev 39d62f9f built Sep 27 2022 14:13:09)
print: Display device : none
print: Capture device : none
print: Audio capture : none
print: Audio playback : portaudio:help
print: MTU : 9000 B
print: Video compression: none
print: Audio codec : PCM
print: Network protocol : UltraGrid RTP
print: Audio FEC : none
print: Video FEC : none

print: nnels: 0 ; Windows WDM-KS)
print: Exit

If you look at the second last line, its actually the end of the 'print: portaudio:53 - Headset Earphone ... ' line,

So I assume the ultragrid script can output lines so fast, that the external has no time to output the current line before it overwritten again.

In your code you use a defer method which might be to slow for some very fast outputs?