summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorIgor Matuszewski <igor@sequoia-pgp.org>2020-03-20 00:34:15 +0100
committerIgor Matuszewski <igor@sequoia-pgp.org>2020-03-31 16:47:23 +0200
commit6b5955cf123743f2dc2916055864b8559963cebc (patch)
tree9f361ac9120ad7e590adb3385f42569b41c41f55 /ipc
parent230e111bb3d8dfb9704f2d66492254bb21323570 (diff)
ipc/gnupg: Use ttyname only under UNIX
Diffstat (limited to 'ipc')
-rw-r--r--ipc/src/gnupg.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/ipc/src/gnupg.rs b/ipc/src/gnupg.rs
index 4ab52d65..408df3cf 100644
--- a/ipc/src/gnupg.rs
+++ b/ipc/src/gnupg.rs
@@ -307,14 +307,15 @@ impl Agent {
/// Computes options that we want to communicate.
fn options() -> Vec<String> {
use std::env::var;
- use std::ffi::CStr;
let mut r = Vec::new();
if let Ok(tty) = var("GPG_TTY") {
r.push(format!("OPTION ttyname={}", tty));
} else {
+ #[cfg(unix)]
unsafe {
+ use std::ffi::CStr;
let tty = libc::ttyname(0);
if ! tty.is_null() {
if let Ok(tty) = CStr::from_ptr(tty).to_str() {