Skip to content

Commit 817a575

Browse files
committed
clean up temp files in tests
1 parent b055935 commit 817a575

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

crates/volta-core/src/monitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use tempfile::NamedTempFile;
88
use crate::command::create_command;
99
use crate::event::Event;
1010

11-
/// send event to the spawned command process
11+
/// Send event to the spawned command process
1212
// if hook command is not configured, this is not called
1313
pub fn send_events(command: &str, events: &[Event]) {
1414
match serde_json::to_string_pretty(&events) {

tests/acceptance/hooks.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ cfg_if::cfg_if! {
3030
// so just copy the tempfile (path in EVENTS_FILE env var) to events.json
3131
const EVENTS_EXECUTABLE: &str = r#"@echo off
3232
copy %EVENTS_FILE% events.json
33+
:: executables should clean up the temp file
34+
del %EVENTS_FILE%
3335
"#;
3436
const SCRIPT_FILENAME: &str = "write-events.bat";
3537
const VOLTA_BINARY: &str = "volta.exe";
@@ -43,6 +45,8 @@ while read line
4345
do
4446
echo "$line" >>events.json
4547
done
48+
# executables should clean up the temp file
49+
/bin/rm "$EVENTS_FILE"
4650
"#;
4751
const SCRIPT_FILENAME: &str = "write-events.sh";
4852
const VOLTA_BINARY: &str = "volta";

tests/acceptance/merged_platform.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,17 @@ cfg_if::cfg_if! {
5858
// copy the tempfile (path in EVENTS_FILE env var) to events.json
5959
const EVENTS_EXECUTABLE: &str = r#"@echo off
6060
copy %EVENTS_FILE% events.json
61+
:: executables should clean up the temp file
62+
del %EVENTS_FILE%
6163
"#;
6264
const SCRIPT_FILENAME: &str = "write-events.bat";
6365
const YARN_SHIM: &str = "yarn.exe";
6466
} else if #[cfg(unix)] {
6567
// copy the tempfile (path in EVENTS_FILE env var) to events.json
6668
const EVENTS_EXECUTABLE: &str = r#"#!/bin/bash
6769
/bin/cp "$EVENTS_FILE" events.json
70+
# executables should clean up the temp file
71+
/bin/rm "$EVENTS_FILE"
6872
"#;
6973
const SCRIPT_FILENAME: &str = "write-events.sh";
7074
const YARN_SHIM: &str = "yarn";

0 commit comments

Comments
 (0)