Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit cb47397

Browse files
author
Achim Schneider
committed
fmt
1 parent 5438356 commit cb47397

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

crates/sandbox/src/lib.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ const DOCKER_PROCESS_TIMEOUT_HARD: Duration = Duration::from_secs(60);
172172

173173
impl Sandbox {
174174
pub fn new() -> Result<Self> {
175-
let scratch = TempDir::new("playground").context(UnableToCreateTempDirSnafuSnafu)?;
175+
let scratch =
176+
TempDir::new("playground").context(UnableToCreateTempDirSnafuSnafu)?;
176177
let input_file = scratch.path().join("input.rs");
177178
let output_dir = scratch.path().join("output");
178179
fs::create_dir(&output_dir).context(UnableToCreateOutputDirSnafuSnafu)?;
@@ -299,7 +300,10 @@ async fn run_command_with_timeout(mut command: Command) -> Result<std::process::
299300

300301
let timeout = DOCKER_PROCESS_TIMEOUT_HARD;
301302
println!("executing command!");
302-
let output = command.output().await.context(UnableToStartCompilerSnafuSnafu)?;
303+
let output = command
304+
.output()
305+
.await
306+
.context(UnableToStartCompilerSnafuSnafu)?;
303307
println!("Done! {:?}", output);
304308
// Exit early, in case we don't have the container
305309
// if !output.status.success() {
@@ -308,7 +312,11 @@ async fn run_command_with_timeout(mut command: Command) -> Result<std::process::
308312
// let response = &output.stdout;
309313
let stdout = String::from_utf8_lossy(&output.stdout);
310314

311-
let id = stdout.lines().next().context(MissingCompilerIdSnafuSnafu)?.trim();
315+
let id = stdout
316+
.lines()
317+
.next()
318+
.context(MissingCompilerIdSnafuSnafu)?
319+
.trim();
312320
let stderr = &output.stderr;
313321

314322
// ----------
@@ -329,7 +337,7 @@ async fn run_command_with_timeout(mut command: Command) -> Result<std::process::
329337
Ok(ExitStatusExt::from_raw(code))
330338
}
331339
Ok(e) => return e.context(UnableToWaitForCompilerSnafuSnafu), // Failed to run
332-
Err(e) => Err(e), // Timed out
340+
Err(e) => Err(e), // Timed out
333341
};
334342

335343
// ----------
@@ -347,7 +355,10 @@ async fn run_command_with_timeout(mut command: Command) -> Result<std::process::
347355
"--force", id
348356
);
349357
command.stdout(std::process::Stdio::null());
350-
command.status().await.context(UnableToRemoveCompilerSnafuSnafu)?;
358+
command
359+
.status()
360+
.await
361+
.context(UnableToRemoveCompilerSnafuSnafu)?;
351362

352363
let code = timed_out.context(CompilerExecutionTimedOutSnafuSnafu { timeout })?;
353364

0 commit comments

Comments
 (0)