14 lines
359 B
TypeScript
14 lines
359 B
TypeScript
import { tspmIpcClient } from '../../classes.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
|
|
}
|
|
}
|
|
} |