Skip to content

Commit c547dfd

Browse files
committed
Application now returns proper exit code.
1 parent 1f5ea2b commit c547dfd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/UppTerm/main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class UppTerm final : TopWindow {
3131
}
3232
}
3333

34-
void Run(const String& cmd)
34+
int Run(const String& cmd)
3535
{
3636
m_terminal.WhenOutput = [&](String s) {
3737
m_pty.Write(s);
3838
};
3939
m_terminal.WhenResize = [&]() {
4040
m_pty.SetSize(m_terminal.GetPageSize());
4141
};
42-
42+
4343
m_pty.Start(cmd.IsEmpty() ? GetEnv(tshell) : cmd, Environment(), GetHomeDirectory());
4444

4545
OpenMain();
@@ -53,7 +53,9 @@ class UppTerm final : TopWindow {
5353
break;
5454
Sleep(l >= 1024 ? 1024 * 10 / l : 10);
5555
}
56+
const auto exit_code = m_pty.GetExitCode();
5657
m_pty.Kill();
58+
return exit_code;
5759
}
5860

5961
private:
@@ -74,5 +76,5 @@ GUI_APP_MAIN
7476
cmd.TrimEnd("\"");
7577
}
7678

77-
UppTerm().Run(cmd);
79+
SetExitCode(UppTerm().Run(cmd));
7880
}

0 commit comments

Comments
 (0)