Skip to content

Commit

Permalink
use conditional compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Sep 11, 2024
1 parent 6209014 commit 6a982a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zebra-rpc/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ pub trait Rpc {
address_strings: AddressStrings,
) -> BoxFuture<Result<Vec<GetAddressUtxos>>>;

#[cfg(not(target_os = "windows"))]
#[rpc(name = "stop")]
/// Stop the running zebrad process.
///
Expand Down Expand Up @@ -1357,8 +1358,9 @@ where
.boxed()
}

#[cfg(not(target_os = "windows"))]
fn stop(&self) -> Result<String> {
if self.network.is_regtest() && cfg!(not(target_os = "windows")) {
if self.network.is_regtest() {
match nix::sys::signal::raise(nix::sys::signal::SIGINT) {
Ok(_) => Ok("Zebra server stopping".to_string()),
Err(error) => Err(Error {
Expand All @@ -1370,8 +1372,7 @@ where
} else {
Err(Error {
code: ErrorCode::MethodNotFound,
message: "stop is only available on *nix platforms and regtest networks"
.to_string(),
message: "stop is only available on regtest networks".to_string(),
data: None,
})
}
Expand Down

0 comments on commit 6a982a2

Please sign in to comment.