Ticket #983 (new defect)

Opened 23 months ago

Last modified 23 months ago

ccl:external-process-id on Windows returns process handle, but not an ID

Reported by: avodonosov Owned by:
Priority: normal Milestone:
Component: Foreign Function Interface Version: trunk
Keywords: Cc:


while in slime I do:

(setf p (ccl:run-program "clisp" '() :wait nil :output t :input t)) (ccl:external-process-id p) ==> #<A Foreign Pointer #x4F0> ;; it's a handle

(#_GetProcessId (ccl:external-process-id p)) ==> 3452 ;; this is the ID

Access to process handle is on Windows useful (most of the API functions use it), but Windows has the concept of process ID and the name ccl:external-process-id suggests we will get the ID.

I am not sure what is the best fix:

  • specify in the docstring that it returns process handle on Windows
  • make it return process ID and possibly provide another function for windows programmerw ccl:external-process-handle or something.

Change History

comment:1 Changed 23 months ago by gb

  • Component changed from IDE to Foreign Function Interface

Neither the (nearly useless but globally unique) Windows process ID nor the (more useful but calling-process-local) handle is an ideal choice as the value returned by EXTERNAL-PROCESS-ID, but the handle seems like a clearly better choice.

I would agree that the documentation shouldn't claim that EXTERNAL-PROCESS-ID returns an integer, and it could mention that the only thing that one can usefully do with that value is to pass it to foreign code. Some Windows foreign code may need to access the global integer process identifier, and as you note it's trivial for that foreign code to call #_GetProcessId if it needs to.

You're welcome to think whatever you want of course, but if you think that things are the way they are because someone didn't understand the difference between that integer and the handle - as you apparently do - you're simply mistaken.

comment:2 Changed 23 months ago by avodonosov

  • Summary changed from ccl:external-process-id on Windows returns process handler, but not an ID to ccl:external-process-id on Windows returns process handle, but not an ID

comment:3 Changed 23 months ago by avodonosov

The ticket description may be read by people who don't understand the difference, not only by someone who made the things as they are. That's why I prefer detailed explanations.

Note: See TracTickets for help on using tickets.