简体   繁体   English

为什么os.fork()之后pyscard无法连接到pcscd服务?

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

I'm on MacOS 10.14.3, if that makes any difference. 我使用的是MacOS 10.14.3,如果有什么不同的话。

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? 为什么在分叉进程并且进入子进程后pyscard无法连接到pcscd服务? And how can I get pyscard to connect correctly in the child process? 以及如何使pyscard在子进程中正确连接?

显然, 如Ludovic Rousseau所报告 ,PCSC的OSX / MacOS实现中存在一个错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM