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

NextPrevUpTopContentsIndex

pipe-kill-process

Function
Summary

Tries to kill the process of a pipe stream.

Package

system

Signature

pipe-kill-process pipe-stream => result

Arguments

pipe-stream

A pipe stream.

Values

result

A boolean.

Description

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 Unix 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.

Notes
  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 of a vector.
See also

open-pipe
call-system


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex