Skip to content

Commit c2b0e3c

Browse files
author
Arnaud Bouchez
committed
refined RunRedirect() documentation
1 parent f03c7b3 commit c2b0e3c

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/core/mormot.core.os.pas

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5531,7 +5531,7 @@ function RunCommand(const cmd: TFileName; waitfor: boolean;
55315531
// use the system code page or even UTF-16 binary with BOM (!) - so you
55325532
// may consider using AnsiToUtf8() with the proper code page
55335533
// - will optionally call onoutput() to notify the new output state
5534-
// - can abort if onoutput() callback returns false, or waitfordelayms expires
5534+
// - aborts if onoutput() callback returns true, or waitfordelayms expires
55355535
// - optional env is Windows only, (FPC popen does not support it), and should
55365536
// be encoded as name=value#0 pairs
55375537
// - you can specify a wrkdir if the path specified by cmd is not good enough
@@ -5548,20 +5548,25 @@ function RunRedirect(const cmd: TFileName; exitcode: PInteger = nil;
55485548

55495549
{$ifdef OSWINDOWS}
55505550
type
5551-
/// how in RunRedirect() or RunCommand() should try to gracefully terminate
5551+
/// how RunRedirect() or RunCommand() should try to gracefully terminate
55525552
// - ramCtrlC calls CancelProcess(), i.e. send CTRL_C_EVENT
55535553
// - ramQuit calls QuitProcess(), i.e. send WM_QUIT on all the process threads
5554+
// - note that TerminateProcess is always called after RunAbortTimeoutSecs
5555+
// timeout, or if this set of methods is void
55545556
TRunAbortMethods = set of (ramCtrlC, ramQuit);
55555557
var
55565558
/// RunRedirect/RunCommand methods to gracefully terminate before TerminateProcess
55575559
RunAbortMethods: TRunAbortMethods = [ramCtrlC, ramQuit];
55585560
{$else}
55595561
type
5560-
/// how in RunRedirect() should try to gracefully terminate
5561-
TRunAbortMethods = set of (ramSIGTERM);
5562+
/// how RunRedirect() should try to gracefully terminate
5563+
// - ramSigTerm send a fpkill(pid, SIGTERM) to the process
5564+
// - note that SIGKILL is always sent after RunAbortTimeoutSecs timeout,
5565+
// or if ramSigTerm was not supplied
5566+
TRunAbortMethods = set of (ramSigTerm);
55625567
var
55635568
/// RunRedirect() methods to gracefully terminate before SIGKILL
5564-
RunAbortMethods: TRunAbortMethods = [ramSIGTERM];
5569+
RunAbortMethods: TRunAbortMethods = [ramSigTerm];
55655570
{$endif OSWINDOWS}
55665571

55675572

src/core/mormot.core.os.posix.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ begin
35113511
if RunAbortTimeoutSecs > 0 then
35123512
begin
35133513
// try gracefull death
3514-
if (ramSIGTERM in RunAbortMethods) and
3514+
if (ramSigTerm in RunAbortMethods) and
35153515
(fpkill(pid, SIGTERM) = 0) then
35163516
begin
35173517
endtix := GetTickCount64 + RunAbortTimeoutSecs * 1000;

src/mormot.commit.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'2.2.7014'
1+
'2.2.7015'

0 commit comments

Comments
 (0)