Skip to content

Commit 9e6038e

Browse files
YedPoolclaude
andcommitted
Add binary validation before execution
Test LiveKit binary with --help to diagnose exec format error 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 650e3e7 commit 9e6038e

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

livekit-server/main.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,32 @@ def start(self):
160160
# Create config file
161161
self.create_config()
162162

163-
# Download server if not exists
164-
if not os.path.exists("/usr/local/bin/livekit-server"):
163+
# Check if server exists and get detailed info
164+
binary_path = "/usr/local/bin/livekit-server"
165+
if os.path.exists(binary_path):
166+
logger.info("✓ LiveKit server binary found")
167+
stat_info = os.stat(binary_path)
168+
logger.info(f" Size: {stat_info.st_size} bytes")
169+
logger.info(f" Mode: {oct(stat_info.st_mode)}")
170+
171+
# Check file type
172+
try:
173+
import subprocess
174+
result = subprocess.run(['file', binary_path], capture_output=True, text=True)
175+
logger.info(f" File type: {result.stdout.strip()}")
176+
except Exception as e:
177+
logger.info(f" Could not determine file type: {e}")
178+
179+
# Test if it's executable by trying to run it with --help
180+
try:
181+
result = subprocess.run([binary_path, '--help'],
182+
capture_output=True, text=True, timeout=5)
183+
logger.info(f" Binary test exit code: {result.returncode}")
184+
if result.stdout:
185+
logger.info(f" Binary help output: {result.stdout[:200]}...")
186+
except Exception as e:
187+
logger.error(f" Binary test failed: {e}")
188+
else:
165189
logger.info("LiveKit server not found, downloading...")
166190
self.download_livekit_server()
167191

0 commit comments

Comments
 (0)