test_with_strace.sh 664 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # Test with strace to see what's happening with file descriptors
  3. echo "Testing with strace..."
  4. strace -e trace=write,read,ioctl -f -o strace.log ./builddir/examples/minimal-server &
  5. SERVER_PID=$!
  6. # Give it a moment to start
  7. sleep 0.5
  8. # Send initialize request
  9. echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {}, "clientInfo": {"name": "test-client", "version": "1.0.0"}}}' | nc -N localhost 0 2>/dev/null || echo "nc failed, trying direct pipe"
  10. # Wait a bit
  11. sleep 1
  12. # Kill the server
  13. kill $SERVER_PID 2>/dev/null
  14. # Show the strace log
  15. echo "=== Strace log ==="
  16. cat strace.log