mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
In TSecureShellCmd.Connect, include parallel happened errors in any success dialog. Also, log errors to the log panel when both pipes have content. Closes #1940
This commit is contained in:
@ -1087,7 +1087,7 @@ end;
|
|||||||
procedure TSecureShellCmd.Connect;
|
procedure TSecureShellCmd.Connect;
|
||||||
var
|
var
|
||||||
SshCmd, SshCmdDisplay, DialogTitle: String;
|
SshCmd, SshCmdDisplay, DialogTitle: String;
|
||||||
OutText, ErrorText, UserInput: String;
|
OutText, ErrorText, AllPipesText, UserInput: String;
|
||||||
rx: TRegExpr;
|
rx: TRegExpr;
|
||||||
StartupInfo: TStartupInfo;
|
StartupInfo: TStartupInfo;
|
||||||
ExitCode: LongWord;
|
ExitCode: LongWord;
|
||||||
@ -1191,21 +1191,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if OutText <> '' then begin
|
if OutText <> '' then begin
|
||||||
|
// Prepend error text in the dialog, e.g. "Unable to use keyfile"
|
||||||
|
AllPipesText := OutText;
|
||||||
|
if not ErrorText.IsEmpty then begin
|
||||||
|
FConnection.Log(lcError, 'SSH: '+ErrorText);
|
||||||
|
AllPipesText := Trim('Error: ' + ErrorText + sLineBreak + AllPipesText);
|
||||||
|
end;
|
||||||
if ExecRegExpr('login as\s*\:', OutText) then begin
|
if ExecRegExpr('login as\s*\:', OutText) then begin
|
||||||
// Prompt for username
|
// Prompt for username
|
||||||
UserInput := InputBox(DialogTitle, OutText, '');
|
UserInput := InputBox(DialogTitle, AllPipesText, '');
|
||||||
SendText(UserInput + CRLF);
|
SendText(UserInput + CRLF);
|
||||||
end else if ExecRegExpr('(password|Passphrase for key "[^"]+")\s*\:', OutText) then begin
|
end else if ExecRegExpr('(password|Passphrase for key "[^"]+")\s*\:', OutText) then begin
|
||||||
// Prompt for sensitive input. Send * as first char of prompt param so InputBox hides input characters
|
// Prompt for sensitive input. Send * as first char of prompt param so InputBox hides input characters
|
||||||
UserInput := InputBox(DialogTitle, #31+OutText, '');
|
UserInput := InputBox(DialogTitle, #31+AllPipesText, '');
|
||||||
SendText(UserInput + CRLF);
|
SendText(UserInput + CRLF);
|
||||||
end else begin
|
end else begin
|
||||||
// Informational message box
|
// Informational message box
|
||||||
rx.Expression := '^[^\.]+\.';
|
rx.Expression := '^[^\.]+\.';
|
||||||
if rx.Exec(OutText) then begin // First words end with a dot - use it as caption
|
if rx.Exec(OutText) then begin // First words end with a dot - use it as caption
|
||||||
MessageDialog(DialogTitle + ': ' + rx.Match[0], OutText, mtInformation, [mbOK])
|
MessageDialog(DialogTitle + ': ' + rx.Match[0], AllPipesText, mtInformation, [mbOK])
|
||||||
end else begin
|
end else begin
|
||||||
MessageDialog(DialogTitle, OutText, mtInformation, [mbOK]);
|
MessageDialog(DialogTitle, AllPipesText, mtInformation, [mbOK]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user