Skip to content

How to shut down an application cleanly? #70

@martinpaljak

Description

@martinpaljak

I am a bit confused about cleanly closing the runtime after I am done with the reader I am interested in.

There is reader.disconnect() which is a wrapper around SCardDisconnect(), thus I obviously call it.

Then there is reader.close() which is intended to call SCardCancel() (for this specific reader?). I call it and get no errors.

Then there is pcsc.close() which is intended to also call SCardCancel() (for PnP reader tracking?). I call it and get an error event on pcsc: SCardGetStatusChange error: Command cancelled.(0x80100002). And the node process does not exit after this call. AFAIU SCardGetStatusChange should never emit an error if it is cancelled (I suspect this is a bug)

Two questions:

  • How do I properly clean up the runtime, without calling process.exit()?
  • Why are there two status checkers? AFAIU one call for SCardGetStatusChange should be sufficient, also for getting events for the pnp pseudo-reader as well as any connected readers, to be able to emit reade events (thus a pcsc.close() should be sufficient, and should result in normal exit of nodejs runtime?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions