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:
@@ -124,6 +124,15 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
child.kill();
|
||||
} catch {
|
||||
}
|
||||
|
||||
if (await waitForChildProcessClose(child, 800)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
spawnSync('taskkill', ['/pid', String(pid), '/t'], {
|
||||
stdio: 'ignore',
|
||||
|
||||
@@ -130,7 +130,7 @@ export function createTerminalRuntime({
|
||||
let lastError = null;
|
||||
for (const shell of shellCandidates) {
|
||||
try {
|
||||
const ptyProcess = pty.spawn(shell, [], {
|
||||
const ptyOptions = {
|
||||
name: 'xterm-256color',
|
||||
cols: cols || 80,
|
||||
rows: rows || 24,
|
||||
@@ -140,7 +140,13 @@ export function createTerminalRuntime({
|
||||
TERM: 'xterm-256color',
|
||||
COLORTERM: 'truecolor',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
ptyOptions.useConpty = true;
|
||||
}
|
||||
|
||||
const ptyProcess = pty.spawn(shell, [], ptyOptions);
|
||||
|
||||
return { ptyProcess, shell };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user