Add a basic Unix socket server using Bun
- Implemented a simple server using the net module. - The server listens on a specified socket path. - Added error handling for server errors. - Included checks to verify the existence of the socket file.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bun
|
||||
import net from 'net';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
const socketPath = '/Users/alexnewman/.claude-mem/test-bun.sock';
|
||||
|
||||
const server = net.createServer(() => {});
|
||||
|
||||
server.listen(socketPath, () => {
|
||||
console.log('Server listening');
|
||||
console.log('existsSync says:', existsSync(socketPath));
|
||||
console.log('Checking with ls...');
|
||||
});
|
||||
|
||||
server.on('error', (err) => {
|
||||
console.error('Error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user