Tom Bull
Tom Bull

Reputation: 1277

Why won't pyscard connect to pcscd service after os.fork()?

I'm on MacOS 10.14.3, if that makes any difference.

When I run this code:

import os
pid = os.fork()
from smartcard.scard import SCardEstablishContext, SCardGetErrorMessage, SCARD_SCOPE_USER
hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
print('Result from {} process: {}'.format('child' if pid == 0 else 'parent', SCardGetErrorMessage(hresult)))

I get this result:

 Result from child process: Service not available.
 Result from parent process: Command successful.

Why does pyscard fail to connect to the pcscd service after I've forked the process and I'm in the child process? And how can I get pyscard to connect correctly in the child process?

Upvotes: 0

Views: 127

Answers (1)

Tom Bull
Tom Bull

Reputation: 1277

Apparently, there's a bug in the OSX / MacOS implementation of PCSC, as reported here by Ludovic Rousseau

Upvotes: 1

Related Questions