Files
FluentTerminal/FluentTerminal.Models/Requests/TerminalExitedRequest.cs
T
Menno Finlay-Smits 7cdda79d67 Bubble up shell process exit codes (#343)
Make the shell process's exit code available to the main app so that
actions can be taken depending on whether the shell command was
successful or not.

Later work will build on this so that failed commands will result in
tabs being left open when the shell command fails. This will help when
troubleshooting incorrectly configured profiles, SSH connection issues
etc.

Exit codes are passed up for both WinPty and ConPty based terminals.
2019-05-01 20:36:56 +02:00

40 lines
1.0 KiB
C#

namespace FluentTerminal.Models.Requests
{
public class TerminalExitedRequest {
public int TerminalId { get; set; }
public int ExitCode { get; set; }
public TerminalExitedRequest(int terminalId, int exitCode)
{
TerminalId = terminalId;
ExitCode = exitCode;
}
public TerminalExitedRequest(int terminalId)
{
TerminalId = terminalId;
ExitCode = -1;
}
// This is for JSON deserialisation.
public TerminalExitedRequest()
{
TerminalId = -1;
ExitCode = -2;
}
// Create a TerminalExitedRequest from a TerminalExitStatus.
public TerminalExitedRequest(TerminalExitStatus status)
{
TerminalId = status.TerminalId;
ExitCode = status.ExitCode;
}
// Convert to a TerminalExitStatus.
public TerminalExitStatus ToStatus()
{
return new TerminalExitStatus(TerminalId, ExitCode);
}
}
}