style: 简化loader 避免全局error

This commit is contained in:
手瓜一十雪 committed 2025-02-03 10:40:33 +08:00
1 parent b25f9d3bec
commit 96de9e2c16
3 files changed
+17 -43

No files matched your search

+6 -13
View File
@@ -1,17 +1,10 @@
import { require_dlopen } from '.';
let pty: any;
try {
pty = require_dlopen('./pty/' + process.platform + '.' + process.arch + '/pty.node');
} catch (outerError) {
export function pty_loader() {
let pty: any;
try {
pty = require_dlopen('./pty/' + process.platform + '.' + process.arch + '/pty.node');
} catch (innerError) {
console.error('innerError', innerError);
// Re-throw the exception from the Release require if the Debug require fails as well
throw outerError;
} catch (outerError) {
pty = undefined;
}
}
export default pty;
return pty;
};