Explore shutting down scdaemon when accessing cards via pcsc.

This commit is contained in:
Heiko Schaefer 2021-08-03 23:18:19 +02:00
parent 897847cb46
commit 1af3a4b5ee
2 changed files with 7 additions and 1 deletions

View file

@ -16,3 +16,4 @@ sequoia-openpgp = "1.3"
anyhow = "1" anyhow = "1"
thiserror = "1.0" thiserror = "1.0"
env_logger = "0.8" env_logger = "0.8"
log = "0.4"

View file

@ -49,6 +49,11 @@ impl TestCard {
fn open(&self) -> Result<CardApp> { fn open(&self) -> Result<CardApp> {
match self { match self {
Self::Pcsc(ident) => { Self::Pcsc(ident) => {
// Attempt to shutdown SCD, if it is running.
// Ignore any errors that occur during that shutdown attempt.
let res = ScdClient::shutdown_scd(None);
log::trace!(" Attempt to shutdown scd: {:?}", res);
for card in PcscClient::list_cards()? { for card in PcscClient::list_cards()? {
let card_client = Box::new(card) as CardClientBox; let card_client = Box::new(card) as CardClientBox;
let mut ca = CardApp::new(card_client); let mut ca = CardApp::new(card_client);