alda-lang / alda

A music programming language for musicians. :notes:
https://alda.io
Eclipse Public License 2.0
5.64k stars 292 forks source link

Alda Processes are not independent of the shell #406

Open elydpg opened 3 years ago

elydpg commented 3 years ago

I'm not sure if this is a universal problem or one that only affects Windows cmd and powershell. It seems that alda processes are not independent of the shell anymore, since if alda is doing something such as play a score from a file or open a REPL and I try and close the shell, it doesn't seem to let me right away.

I think the problem is best illustrated in the below recordings:

https://user-images.githubusercontent.com/8622264/138393978-8fb3b9a0-fb86-4c54-802a-cd998c02409c.mp4

(PowerShell)

https://user-images.githubusercontent.com/8622264/138393990-6afd4066-06a9-4679-bd1d-7a13341c9a77.mp4

(Cmd)

Checking the task manager reveals that when I, say, play a score, the player processes are children of the shell:

Screenshot (23)

daveyarwood commented 3 years ago

I think this is Windows-specific. I noticed something kind of similar when I was setting up the CI build for Windows, in that I had to disable the automatic spawning of player processes in order to get the build not to hang. My hunch is that the alda-player processes were being created as child processes of the terminal process, and the terminal process wasn't exiting because the player processes were still running.

Ideally, the player processes should be independent of the shell. On my Linux machine, I can run alda play -f /path/to/some-long-score.alda, and exit the terminal process, and I can still hear my score playing in the background. I can open a new terminal process and run alda stop to stop the playback.

My knowledge of Windows is lacking, so I would really appreciate any pointers about how to make the experience better here for Windows users!