Preventing a child process (HandbrakeCLI) from causing the parent script to exit

前端 未结 1 348
甜味超标
甜味超标 2020-12-19 10:42

I have a batch conversion script to turn .mkvs of various dimensions into ipod/iphone sized .mp4s, cropping/scaling to suit. Determining the original dimensions, required cr

1条回答
  •  [愿得一人]
    2020-12-19 11:24

    Now resolved, thanks to a clue from this other thread. I now echo nothing into HandbrakeCLI to ensure it's not using the same stdin as my script:

    find . -name "*.mkv" | while read FILE
    do
        echo "" | handbrake-touch "$FILE"
    
        if [ $? != 0 ]
        then
            echo "$FILE had problems" >> errors.log  
        fi
    done
    

    ...and it works as intended/expected.

    0 讨论(0)
提交回复
热议问题