Skip to content

Commit e8289e0

Browse files
committed
Fix password handling for mysqldef and mssqldef
When password is empty, don't include the -p flag at all as it causes the commands to expect the password as the next argument, leading to connection failures in CI.
1 parent c01f5e6 commit e8289e0

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ function getCommandConfig(command) {
126126
config.args.push("-h", host, "-P", port);
127127
if (user)
128128
config.args.push("-u", user);
129-
if (password)
129+
// Only add -p flag if password is not empty
130+
if (password && password.trim() !== "") {
130131
config.args.push(`-p${password}`);
132+
}
131133
if (database)
132134
config.args.push(database);
133135
break;
@@ -147,8 +149,10 @@ function getCommandConfig(command) {
147149
config.args.push("-h", host, "-P", port);
148150
if (user)
149151
config.args.push("-U", user);
150-
if (password)
152+
// Only add -p flag if password is not empty
153+
if (password && password.trim() !== "") {
151154
config.args.push(`-p${password}`);
155+
}
152156
if (database)
153157
config.args.push(database);
154158
break;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ function getCommandConfig(command: string): CommandConfig {
100100

101101
config.args.push("-h", host, "-P", port);
102102
if (user) config.args.push("-u", user);
103-
if (password) config.args.push(`-p${password}`);
103+
// Only add -p flag if password is not empty
104+
if (password && password.trim() !== "") {
105+
config.args.push(`-p${password}`);
106+
}
104107
if (database) config.args.push(database);
105108
break;
106109
}
@@ -118,7 +121,10 @@ function getCommandConfig(command: string): CommandConfig {
118121

119122
config.args.push("-h", host, "-P", port);
120123
if (user) config.args.push("-U", user);
121-
if (password) config.args.push(`-p${password}`);
124+
// Only add -p flag if password is not empty
125+
if (password && password.trim() !== "") {
126+
config.args.push(`-p${password}`);
127+
}
122128
if (database) config.args.push(database);
123129
break;
124130
}

0 commit comments

Comments
 (0)