Skip to content

Commit

Permalink
Fix preview kill on drop (ordinals#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph authored Jan 16, 2023
1 parent 8f203ae commit db765e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/subcommand/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ struct KillOnDrop(process::Child);

impl Drop for KillOnDrop {
fn drop(&mut self) {
Command::new("kill")
.arg("-SIGINT")
.arg(self.0.id().to_string())
.spawn()
.expect("failed to SIGINT kill process");
self.0.kill().unwrap()
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ struct KillOnDrop(std::process::Child);

impl Drop for KillOnDrop {
fn drop(&mut self) {
Command::new("kill")
.arg("-SIGINT")
assert!(Command::new("kill")
.arg(self.0.id().to_string())
.spawn()
.expect("failed to SIGINT kill process");
.status()
.unwrap()
.success());
}
}

Expand Down

0 comments on commit db765e9

Please sign in to comment.