Storing the metadata for a video using in a file using youtube-dl can be done in bash by calling
youtube-dl -j https://www.youtube.com/watch?v=${video_id} > metadata.json
However, when the video is referenced in the context of a playlist, that is, by calling
youtube-dl -j https://www.youtube.com/watch?v=${video_id}&list=${list_id}&index=${index} > metadata.json
then youtube-dl forks or detaches from the shell (am I understanding this correctly?) and the output is sent to the terminal instead of to the file. The process seems to get stuck waiting for something. It can be terminated using ctrl-c.
Why does youtube-dl do this and can I prevent it from happening? I want to store the metadata related to the playlist as well as the metadata related to the video.