mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: remove __dirname
This commit is contained in:
@@ -13,12 +13,13 @@ import { IProcessEnv, IPtyForkOptions, IPtyOpenOptions } from '@homebridge/node-
|
|||||||
import { ArgvOrCommandLine } from '@homebridge/node-pty-prebuilt-multiarch/src/types';
|
import { ArgvOrCommandLine } from '@homebridge/node-pty-prebuilt-multiarch/src/types';
|
||||||
import { assign } from '@homebridge/node-pty-prebuilt-multiarch/src/utils';
|
import { assign } from '@homebridge/node-pty-prebuilt-multiarch/src/utils';
|
||||||
import { pty_loader } from './prebuild-loader';
|
import { pty_loader } from './prebuild-loader';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
export const pty = pty_loader();
|
export const pty = pty_loader();
|
||||||
|
|
||||||
let helperPath: string;
|
let helperPath: string;
|
||||||
helperPath = '../build/Release/spawn-helper';
|
helperPath = '../build/Release/spawn-helper';
|
||||||
|
const import__dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
helperPath = path.resolve(__dirname, helperPath);
|
helperPath = path.resolve(import__dirname, helperPath);
|
||||||
helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
|
helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
|
||||||
helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
|
helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
|
||||||
|
|
||||||
|
@@ -14,6 +14,8 @@ import { ArgvOrCommandLine } from '@homebridge/node-pty-prebuilt-multiarch/src/t
|
|||||||
import { fork } from 'child_process';
|
import { fork } from 'child_process';
|
||||||
import { ConoutConnection } from './windowsConoutConnection';
|
import { ConoutConnection } from './windowsConoutConnection';
|
||||||
import { require_dlopen } from '.';
|
import { require_dlopen } from '.';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
|
||||||
let conptyNative: IConptyNative;
|
let conptyNative: IConptyNative;
|
||||||
let winptyNative: IWinptyNative;
|
let winptyNative: IWinptyNative;
|
||||||
@@ -149,7 +151,7 @@ export class WindowsPtyAgent {
|
|||||||
consoleProcessList.forEach((pid: number) => {
|
consoleProcessList.forEach((pid: number) => {
|
||||||
try {
|
try {
|
||||||
process.kill(pid);
|
process.kill(pid);
|
||||||
} catch{
|
} catch {
|
||||||
// Ignore if process cannot be found (kill ESRCH error)
|
// Ignore if process cannot be found (kill ESRCH error)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -176,8 +178,9 @@ export class WindowsPtyAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _getConsoleProcessList(): Promise<number[]> {
|
private _getConsoleProcessList(): Promise<number[]> {
|
||||||
|
const import__dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
return new Promise<number[]>(resolve => {
|
return new Promise<number[]>(resolve => {
|
||||||
const agent = fork(path.join(__dirname, 'conpty_console_list_agent'), [this._innerPid.toString()]);
|
const agent = fork(path.join(import__dirname, 'conpty_console_list_agent'), [this._innerPid.toString()]);
|
||||||
agent.on('message', message => {
|
agent.on('message', message => {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
// @ts-expect-error no need to check if it is null
|
// @ts-expect-error no need to check if it is null
|
||||||
|
Reference in New Issue
Block a user