From e0e39833e6fcccac039ca3c33fdc80eb605e9242 Mon Sep 17 00:00:00 2001 From: Igor Pellinen Date: Tue, 22 Oct 2024 23:27:03 +0300 Subject: [PATCH] fix: delaying for three seconds while waiting to supervisorctl to be idle (issue #833) --- lib/docker-sync/sync_strategy/native_osx.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/docker-sync/sync_strategy/native_osx.rb b/lib/docker-sync/sync_strategy/native_osx.rb index a6f5090..84f8935 100644 --- a/lib/docker-sync/sync_strategy/native_osx.rb +++ b/lib/docker-sync/sync_strategy/native_osx.rb @@ -95,7 +95,9 @@ def start_container cmd = "docker run -d -v \"#{volume_app_sync_name}:/app_sync\" -v \"#{host_sync_src}:/host_sync#{host_disk_mount_mode}\" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync #{tz_expression} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image}" else say_status 'ok', "starting #{container_name} container", :white if @options['verbose'] - cmd = "docker start #{container_name} && docker exec #{container_name} supervisorctl restart unison" + cmd1 = "docker start #{container_name}" + cmd2 = "docker exec #{container_name} supervisorctl restart unison" + cmd = "#{cmd1} && (#{cmd2} || (sleep 3 && #{cmd2})) || exit 1" end else say_status 'ok', "#{container_name} container still running, restarting unison in container", :blue