All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

pipe-kill-process Function


Tries to kill the process of a pipe stream.




pipe-kill-process pipe-stream => result

A pipe stream.
A boolean.

The function pipe-kill-process tries to kill the process of a pipe stream.

pipe-stream must be the result of open-pipe. pipe-kill-process tries to kill the process that open-pipe creates.

The return value nil means that the process has already died. In this case the process is guaranteed to have died.

The return value t means that the process was still alive when pipe-kill-process was called, and it tried to kill it.

On Microsoft Windows, it causes the process to exit, but there may be some delay until it actually exits, so the process may still be alive at the time pipe-kill-process returns.

On non-Windows platforms, it sends SIGTERM to the process, which normally would cause it to exit, but in principle the process may handle SIGTERM and continue to run.

  1. When open-pipe is called with a string, it executes it using a shell (non-Windows) or cmd (Windows), so the process that pipe-kill-process will kill is the shell or cmd. When open-pipe is called with a list, it executes the process (first element of the list) directly, and pipe-kill-process kills this process (the different behavior is actually documented in call-system).
  2. On Microsoft Windows, pipe-kill-process needs to be be called before the stream is closed by close. On Unix-like systems it works after close too, but for compatibility pipe-kill-process should not be called after close.
  3. On Unix-like systems, if open-pipe was called with save-exit-status nil, there is a possibility that the child process that open-pipe started died and another process started with the same Process ID, and then pipe-kill-process may wrongly kill the new process. When open-pipe is called with save-exit-status non-nil, the status of the child process is tracked properly, and pipe-kill-process is guaranteed to do the right thing. On Windows pipe-kill-process always does the right thing.
  4. When open-pipe was called with a string as the command, the process killed is the shell (Unix) or cmd (Windows), which normally kills the child process too. On Unix-like systems the shell may execute the child process directly (overwriting itself with the child without forking) in which case it will kill the child. If you want to guarantee killing of the actual child, pass the command to open-pipe as a list or a vector.
See also


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02