0
I'm running Cygwin. I came across the following snippet of Bash code from the FFmpeg Wiki's guide to compiling FFmpeg:
cd /ffmpeg_sources && if cd x265 2> /dev/null; then hg pull && hg update && cd ..; \
else hg clone https://bitbucket.org/multicoreware/x265; fi
As I understand it, it's a pretty basic if
statement that returns non-zero if a CD into directory x265 fails (i.e. if it doesn't exist), and then clones from the Mercurial repository, which would create the x265 folder ready to be pulled and updated the next time.
The error from the failed cd x265
is repressed as expected, but then I also get the following output:
abort: no repository found in '/ffmpeg_sources' (.hg not found)!
This output seems to be a result of the then hg pull && hg update && cd ..;
portion of the statement, and is unexpected because at that point it should simply fall back to cloning the directory.
The only thing that occurs to me is that the code on the FFmpeg Wiki is outdated, and that Mercurial has since then implemented a fatal abort on unsuccessful location of the .hg
directory. Am I right, or am I missing something obvious here?
Wow, great catch! My
cd
is indeed aliased to a function that also doesls
immediately after, which is obviously why it was returning true, I've just had it that way for so long it slipped my mind. And good point about the debugging tip, I'll need to bear that in mind for the future. Thanks for your help. – Hashim – 2019-03-13T02:38:01.093