From 75ea04e90072c609df80f04231fa230492f1635d Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Fri, 13 Jan 2023 08:40:52 +0800 Subject: [PATCH] pty: print process exit code on error --- src/pty.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pty.c b/src/pty.c index 759410a..bbe8e22 100644 --- a/src/pty.c +++ b/src/pty.c @@ -354,6 +354,8 @@ int pty_spawn(pty_process *process, pty_read_cb read_cb, pty_exit_cb exit_cb) { if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, cwd, &process->si.StartupInfo, &pi)) { print_error("CreateProcessW"); + DWORD exitCode = 0; + if (GetExitCodeProcess(pi.hProcess, &exitCode)) printf("== exit code: %d\n", exitCode); goto cleanup; } -- 2.43.4