Skip to content

Commit

Permalink
Disable source by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Jul 30, 2024
1 parent 41d573d commit 32d8f53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ var (
)

func init() {
// Disable the `--source` command by default to avoid breaking existing tests
disableSource = true

flag.StringVar(&host, "host", "127.0.0.1", "The host of the TiDB/MySQL server.")
flag.StringVar(&port, "port", "4000", "The listen port of TiDB/MySQL server.")
flag.StringVar(&user, "user", "root", "The user for connecting to the database.")
Expand Down Expand Up @@ -523,7 +526,7 @@ func (t *tester) runQueries(queries []query) (int, error) {
disableSource = true
case Q_SOURCE:
if disableSource {
log.WithFields(log.Fields{"line": q.location()}).Warn("source command disabled")
log.WithFields(log.Fields{"line": q.location()}).Warn("source command disabled, add '--enable_source' to your file to enable")
break
}
fileName := strings.TrimSpace(q.Query)
Expand Down
2 changes: 2 additions & 0 deletions t/source.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--enable_source

--echo before source
--source include/hello1.inc
--echo after source
Expand Down

0 comments on commit 32d8f53

Please sign in to comment.