Skip to content

Commit 29b8098

Browse files
authored
devops: fix running docker when executed from cronjob (microsoft#3822)
Turns out docker doesn't like faking terminal if STDIN is not attached to a real terminal.
1 parent ee98bd0 commit 29b8098

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

browser_patches/ffmpeg/build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ elif [[ "$1" == --cross-compile-win* ]]; then
4545
exit 1
4646
fi
4747

48+
dockerflags="";
49+
# Use |-it| to run docker to support Ctrl-C if we run the script inside interactive terminal.
50+
# Otherwise (e.g. cronjob) - do nothing.
51+
if [[ -t 0 ]]; then
52+
dockerflags="-it"
53+
fi
54+
4855
if [[ "$1" == "--cross-compile-win32" ]]; then
49-
time docker run --init --rm -v"${PWD}":/host -it ubuntu:18.04 bash /host/crosscompile-from-linux-to-win.sh --win32 /host/output/ffmpeg-win32.exe
56+
time docker run --init --rm -v"${PWD}":/host ${dockerflags} ubuntu:18.04 bash /host/crosscompile-from-linux-to-win.sh --win32 /host/output/ffmpeg-win32.exe
5057
cd output && zip ffmpeg.zip ffmpeg-win32.exe
5158
elif [[ "$1" == "--cross-compile-win64" ]]; then
52-
time docker run --init --rm -v"${PWD}":/host -it ubuntu:18.04 bash /host/crosscompile-from-linux-to-win.sh --win64 /host/output/ffmpeg-win64.exe
59+
time docker run --init --rm -v"${PWD}":/host ${dockerflags} ubuntu:18.04 bash /host/crosscompile-from-linux-to-win.sh --win64 /host/output/ffmpeg-win64.exe
5360
cd output && zip ffmpeg.zip ffmpeg-win64.exe
5461
else
5562
echo "ERROR: unsupported platform - $1"

0 commit comments

Comments
 (0)