fix: reduce Windows console popups in web backend
Prefer graceful process termination before taskkill fallback Force ConPTY for Windows terminal sessions to avoid console flashes Keep git and server process operations running without visible command windows
This commit is contained in:
@@ -1821,6 +1821,15 @@ async function terminateProcessTree(pid, options = {}) {
|
|||||||
: 3000;
|
: 3000;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
try {
|
||||||
|
process.kill(pid);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await waitForProcessExit(pid, 800)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
spawnSync('taskkill', ['/pid', String(pid), '/t'], {
|
spawnSync('taskkill', ['/pid', String(pid), '/t'], {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
|
|||||||
@@ -124,6 +124,15 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
try {
|
||||||
|
child.kill();
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await waitForChildProcessClose(child, 800)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
spawnSync('taskkill', ['/pid', String(pid), '/t'], {
|
spawnSync('taskkill', ['/pid', String(pid), '/t'], {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export function createTerminalRuntime({
|
|||||||
let lastError = null;
|
let lastError = null;
|
||||||
for (const shell of shellCandidates) {
|
for (const shell of shellCandidates) {
|
||||||
try {
|
try {
|
||||||
const ptyProcess = pty.spawn(shell, [], {
|
const ptyOptions = {
|
||||||
name: 'xterm-256color',
|
name: 'xterm-256color',
|
||||||
cols: cols || 80,
|
cols: cols || 80,
|
||||||
rows: rows || 24,
|
rows: rows || 24,
|
||||||
@@ -140,7 +140,13 @@ export function createTerminalRuntime({
|
|||||||
TERM: 'xterm-256color',
|
TERM: 'xterm-256color',
|
||||||
COLORTERM: 'truecolor',
|
COLORTERM: 'truecolor',
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
ptyOptions.useConpty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ptyProcess = pty.spawn(shell, [], ptyOptions);
|
||||||
|
|
||||||
return { ptyProcess, shell };
|
return { ptyProcess, shell };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user