Skip to content

Commit b7c3d07

Browse files
committed
fix: use default brew path to sshpass on macOS
See https://www.heidisql.com/forum.php?t=44716
1 parent dfb86d5 commit b7c3d07

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

source/dbconnection.pas

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ TSecureShellCmd = class(TObject)
269269
procedure Connect;
270270
constructor Create(Connection: TDBConnection);
271271
destructor Destroy; override;
272+
function SshpassPath: String;
272273
end;
273274

274275
TSQLFunction = class(TPersistent)
@@ -1034,6 +1035,15 @@ destructor TSecureShellCmd.Destroy;
10341035
inherited;
10351036
end;
10361037

1038+
function TSecureShellCmd.SshpassPath: String;
1039+
begin
1040+
{$IFDEF DARWIN}
1041+
// See https://www.heidisql.com/forum.php?t=44716
1042+
Result := '/opt/homebrew/bin/sshpass';
1043+
{$ELSE}
1044+
Result := '';
1045+
{$ENDIF}
1046+
end;
10371047

10381048
procedure TSecureShellCmd.Connect;
10391049
var
@@ -1085,7 +1095,7 @@ procedure TSecureShellCmd.Connect;
10851095
SshCmd := SshCmd + ' -N -L ' + IntToStr(FConnection.Parameters.SSHLocalPort) + ':' + FConnection.Parameters.Hostname + ':' + IntToStr(FConnection.Parameters.Port);
10861096

10871097
if not EnvSshpass.IsEmpty then begin
1088-
SshCmd := 'sshpass -e ' + SshCmd;
1098+
SshCmd := SshpassPath + ' -e ' + SshCmd;
10891099
EnvList := TStringList.Create;
10901100
for i := 0 to GetEnvironmentVariableCount - 1 do
10911101
EnvList.Add(GetEnvironmentString(i));

0 commit comments

Comments
 (0)