15 lines
364 B
TypeScript
15 lines
364 B
TypeScript
import { tspmIpcClient } from '../../client/tspm.ipcclient.js';
|
|
|
|
// Helper function to run IPC commands with automatic disconnect
|
|
export async function runIpcCommand<T>(body: () => Promise<T>): Promise<T> {
|
|
try {
|
|
return await body();
|
|
} finally {
|
|
try {
|
|
await tspmIpcClient.disconnect();
|
|
} catch {
|
|
// Ignore disconnect errors
|
|
}
|
|
}
|
|
}
|