Skip to content

Commit

Permalink
asyncproc: Expose close
Browse files Browse the repository at this point in the history
  • Loading branch information
Menduist committed May 19, 2022
1 parent 84ced6d commit 066d3d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions asynctools/asyncproc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ proc kill*(p: AsyncProcess)
## Kill the process ``p``. On Posix OSes the procedure sends ``SIGKILL`` to
## the process. On Windows ``kill()`` is simply an alias for ``terminate()``.

proc close*(p: AsyncProcess)
## When the process has finished executing, cleanup related handles.

proc running*(p: AsyncProcess): bool
## Returns `true` if the process ``p`` is still running. Returns immediately.

Expand Down Expand Up @@ -264,7 +267,7 @@ when defined(windows):
inc(L, x.len+1)
(str, L)

proc close(p: AsyncProcess) =
proc close*(p: AsyncProcess) =
if p.inPipe != nil: close(p.inPipe)
if p.outPipe != nil: close(p.outPipe)
if p.errPipe != nil: close(p.errPipe)
Expand Down Expand Up @@ -782,7 +785,7 @@ else:
startProcessFail(data)
{.pop}

proc close(p: AsyncProcess) =
proc close*(p: AsyncProcess) =
## We need to `wait` for process, to avoid `zombie`, so if `running()`
## returns `false`, then process exited and `wait()` was called.
doAssert(not p.running())
Expand Down

0 comments on commit 066d3d8

Please sign in to comment.