diff --git a/bin/hermes-web-ui.mjs b/bin/hermes-web-ui.mjs index bb84191..5fd6826 100755 --- a/bin/hermes-web-ui.mjs +++ b/bin/hermes-web-ui.mjs @@ -86,6 +86,7 @@ function startDaemon(port) { detached: true, stdio: ['ignore', logStream, logStream], env: { ...process.env, PORT: String(port) }, + windowsHide: true, }) child.on('error', (err) => { @@ -199,6 +200,7 @@ function doUpdate() { const child = spawn(isWin ? 'cmd' : 'sh', isWin ? ['/c', ...cmd.split(' ')] : ['-c', cmd], { stdio: 'inherit', + windowsHide: true, }) child.on('exit', (code) => { @@ -235,6 +237,7 @@ switch (command) { const child = spawn(process.execPath, [serverEntry], { stdio: 'inherit', env: { ...process.env, PORT: String(port) }, + windowsHide: true, }) child.on('exit', (code) => process.exit(code ?? 1)) process.on('SIGTERM', () => child.kill('SIGTERM')) diff --git a/package.json b/package.json index 888c185..92e2d83 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "start": "vite --host --port 8648", "dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"", "dev:client": "vite --host", - "dev:server": "nodemon --watch server/src --ext ts --exec node -r ts-node/register server/src/index.ts", + "dev:server": "nodemon --watch server/src --ext ts --exec node -r ts-node/register server/src/index.ts --no-warnings", "build": "vue-tsc -b && vite build && tsc -p server/tsconfig.json", "preview": "vite preview" }, diff --git a/server/src/services/hermes-cli.ts b/server/src/services/hermes-cli.ts index 17b5dab..bca9cab 100644 --- a/server/src/services/hermes-cli.ts +++ b/server/src/services/hermes-cli.ts @@ -3,6 +3,8 @@ import { promisify } from 'util' const execFileAsync = promisify(execFile) +const execOpts = { windowsHide: true } + export interface HermesSession { id: string source: string @@ -65,6 +67,7 @@ export async function listSessions(source?: string, limit?: number): Promise { const { stdout } = await execFileAsync('hermes', args, { maxBuffer: 50 * 1024 * 1024, timeout: 30000, + ...execOpts, }) const lines = stdout.trim().split('\n').filter(Boolean) @@ -170,6 +174,7 @@ export async function deleteSession(id: string): Promise { try { await execFileAsync('hermes', ['sessions', 'delete', id, '--yes'], { timeout: 10000, + ...execOpts, }) return true } catch (err: any) { @@ -185,6 +190,7 @@ export async function renameSession(id: string, title: string): Promise try { await execFileAsync('hermes', ['sessions', 'rename', id, title], { timeout: 10000, + ...execOpts, }) return true } catch (err: any) { @@ -204,7 +210,7 @@ export interface LogFileInfo { */ export async function getVersion(): Promise { try { - const { stdout } = await execFileAsync('hermes', ['--version'], { timeout: 5000 }) + const { stdout } = await execFileAsync('hermes', ['--version'], { timeout: 5000, ...execOpts }) return stdout.trim() } catch { return '' @@ -217,6 +223,7 @@ export async function getVersion(): Promise { export async function startGateway(): Promise { const { stdout, stderr } = await execFileAsync('hermes', ['gateway', 'start'], { timeout: 30000, + ...execOpts, }) return stdout || stderr } @@ -230,6 +237,7 @@ export async function startGatewayBackground(): Promise { const child = spawn('hermes', ['gateway', 'run'], { detached: true, stdio: 'ignore', + windowsHide: true, }) child.unref() return child.pid ?? null @@ -241,6 +249,7 @@ export async function startGatewayBackground(): Promise { export async function restartGateway(): Promise { const { stdout, stderr } = await execFileAsync('hermes', ['gateway', 'restart'], { timeout: 30000, + ...execOpts, }) return stdout || stderr } @@ -252,6 +261,7 @@ export async function listLogFiles(): Promise { try { const { stdout } = await execFileAsync('hermes', ['logs', 'list'], { timeout: 10000, + ...execOpts, }) const files: LogFileInfo[] = [] const lines = stdout.trim().split('\n').filter(l => l.includes('.log')) @@ -291,6 +301,7 @@ export async function readLogs( const { stdout } = await execFileAsync('hermes', args, { maxBuffer: 10 * 1024 * 1024, timeout: 15000, + ...execOpts, }) return stdout } catch (err: any) {