dw-0 / kiauh

Klipper Installation And Update Helper
GNU General Public License v3.0
3.3k stars 474 forks source link

Multi Printer setup using gcode shell command does not play audio unless command used multiple times and only on second printer when shell script is run in background (&) #446

Closed yourbuddydinec closed 7 months ago

yourbuddydinec commented 7 months ago

Linux Distribution

Ubuntu 23.10.1

What happened

When trying to run a shell script that should play audio using aplay that runs in the background with & at the end of it some commands to not run unless you try to run them multiple times. It seems running it 3 times will get it to finally play the audio. The command itself seems to run as I have added echo TEST to it and it does show in the console but the audio just does not play. If the & is removed from the file it will play just fine every time though.

The weirdest thing is this ONLY happens on my second printer on the same computer. One is named E3 and the other S8 and the S8 one had the problem but not the E3 one despite the script being the same, the wav file being the same, and the config file being the same across both printer configs.

Broken one:

#!/bin/bash
aplay "$1" &

Working one:

#!/bin/bash
aplay "$1"

What did you expect to happen

Wav file to be played when the command is sent the first time and on both printers of a multi printer setup

How to reproduce

Include a & at the end of the script file. Happens for TTS ones as well using espeak.

Additional information

I have allso tried changing the command run from sh /scriptfilename to bash /scriptfilename to /scriptfilename and also tried changing #!/bin/bash to #!/bin/sh with no luck either