Monorepo for Aesthetic.Computer aesthetic.computer
at main 56 lines 1.8 kB view raw
1#!/bin/sh 2# Wrapper to run entry.fish in background so VS Code can connect immediately 3# The heavy setup continues in background and creates .waiter when done 4 5LOG_DIR="/workspaces/aesthetic-computer/.devcontainer/entry-logs" 6mkdir -p "$LOG_DIR" 7TIMESTAMP=$(date +%Y%m%d_%H%M%S) 8BG_LOG="$LOG_DIR/background-$TIMESTAMP.log" 9WRAPPER_LOG="$LOG_DIR/wrapper-$TIMESTAMP.log" 10 11# Function to log with timestamp 12log() { 13 MSG="[$(date '+%H:%M:%S.%3N')] $1" 14 echo "$MSG" 15 echo "$MSG" >> "$WRAPPER_LOG" 16 sync 2>/dev/null 17} 18 19log "🚀 poststart-wrapper.sh starting" 20log "📋 Wrapper log: $WRAPPER_LOG" 21log "📋 Background log: $BG_LOG" 22log "🖥️ Hostname: $(hostname 2>/dev/null || cat /etc/hostname 2>/dev/null || echo 'unknown')" 23log "👤 User: $(whoami)" 24log "📁 PWD: $(pwd)" 25 26# Create a marker so we know wrapper was actually used 27touch "$LOG_DIR/.wrapper-used-$TIMESTAMP" 28log "✅ Created wrapper marker" 29 30# Run entry.fish in background, redirect output to log 31log "🔄 Starting entry.fish in background..." 32nohup fish /workspaces/aesthetic-computer/.devcontainer/entry.fish > "$BG_LOG" 2>&1 & 33BG_PID=$! 34 35log "✅ entry.fish started with PID: $BG_PID" 36 37# Create symlinks to latest logs 38ln -sf "$BG_LOG" "$LOG_DIR/latest-background.log" 39ln -sf "$WRAPPER_LOG" "$LOG_DIR/latest-wrapper.log" 40log "🔗 Created symlinks to latest logs" 41 42# Give a moment for critical early setup (dockerd, basic env) 43log "⏳ Waiting 3 seconds for critical setup..." 44sleep 3 45 46# Check if process is still running 47if kill -0 $BG_PID 2>/dev/null; then 48 log "✅ Background process still running (PID: $BG_PID)" 49else 50 log "⚠️ Background process may have exited early" 51fi 52 53log "🎉 Wrapper complete - VS Code can now connect" 54log "📖 Monitor progress: tail -f $BG_LOG" 55log "🏁 poststart-wrapper.sh finished" 56