From 62aa11506a7cb014c5d9f0518da31c8b1468e1a0 Mon Sep 17 00:00:00 2001 From: "Zhuohuan LI (CARPE DIEM)" Date: Tue, 1 Nov 2016 12:35:14 +0800 Subject: [PATCH] output more diagnose information when docker run bot fail #66 --- bin/entrypoint.sh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 366c8d34..21f66d0b 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -45,10 +45,38 @@ if [[ "$1" == *.ts || "$1" == *.js ]]; then echo "Executing ts-node $botFilePath $@" ts-node "$botFilePath" $@ ret=$? + + (( $ret != 0 )) && { + read -t 10 -p "Hit ENTER to see the diagnose output ... " + + echo "### 1. code of $botFile" + cat $botFilePath + + echo '### 2. directory structor of /bot' + ls -l /bot + + echo '### 3. package.json' + cat /bot/package.json + + echo '### 4. directory structor inside /bot/node_modules' + ls /bot/node_modules + + echo '### 5. wechaty doctor' + wechaty-doctor + + echo '### please include the above diagnose messages if you submit a issue ###' + echo + echo 'Wechaty Issue https://github.com/wechaty/wechaty/issues' + echo + + figlet ' BUG REPORT ' + } + figlet " Wechaty " echo ____________________________________________________ echo " https://www.wechaty.io" figlet " Exit $ret " + sleep 3 exit $ret else @@ -61,7 +89,7 @@ if [[ "$1" == *.ts || "$1" == *.js ]]; then 1. Did you bind the current directory into container? check your `docker run ...` command, if there's no `volumn` arg, - then you need to add one to bind the volume of /bot: + then you need to add it so that we can bind the volume of /bot: `--volume="$PWD":/bot` -- GitLab