Skip to content

Commit b80af30

Browse files
authored
Add random string in path generation (#249)
1 parent f0cda70 commit b80af30

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Cargo.lock

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

sqllogictest/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ subst = "0.3"
2525
tempfile = "3"
2626
thiserror = "2"
2727
tracing = "0.1"
28+
rand = "0.8.5"
2829

2930
[dev-dependencies]
3031
pretty_assertions = "1"

sqllogictest/src/runner.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use futures::{stream, Future, FutureExt, StreamExt};
1414
use itertools::Itertools;
1515
use md5::Digest;
1616
use owo_colors::OwoColorize;
17+
use rand::Rng;
1718
use similar::{Change, ChangeTag, TextDiff};
1819

1920
use crate::parser::*;
@@ -1339,7 +1340,12 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {
13391340

13401341
fn create_outfile(filename: impl AsRef<Path>) -> std::io::Result<(PathBuf, File)> {
13411342
let filename = filename.as_ref();
1342-
let outfilename = filename.file_name().unwrap().to_str().unwrap().to_owned() + ".temp";
1343+
let outfilename = format!(
1344+
"{}{:010}{}",
1345+
filename.file_name().unwrap().to_str().unwrap().to_owned(),
1346+
rand::thread_rng().gen_range(0..10_000_000),
1347+
".temp"
1348+
);
13431349
let outfilename = filename.parent().unwrap().join(outfilename);
13441350
// create a temp file in read-write mode
13451351
let outfile = OpenOptions::new()

0 commit comments

Comments
 (0)