From dc2db7676b18b1c42c5f3529d48751b7e709b029 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 8 Nov 2014 01:16:39 +0100 Subject: [PATCH] added another TProcess util to ce_common --- src/ce_common.pas | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ce_common.pas b/src/ce_common.pas index b029584e..7b533a07 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -189,6 +189,11 @@ type *) procedure killProcess(var aProcess: TAsyncProcess); + (** + * Ensures that the in/out process pipes are not redirected, that it has a console, if it waits on exit. + *) + procedure ensureNoPipeIfWait(const aProcess: TProcess); + implementation // https://stackoverflow.com/questions/25438091/objectbinarytotext-error-with-a-treader-twriter-helper-class @@ -712,6 +717,15 @@ begin aProcess := nil; end; +procedure ensureNoPipeIfWait(const aProcess: TProcess); +begin + if not (poWaitonExit in aProcess.Options) then + exit; + // + aProcess.Options := aProcess.Options - [poStderrToOutPut, poUsePipes]; + aProcess.Options := aProcess.Options + [poNewConsole]; +end; + initialization RegisterClasses([TMRUList, TMRUFileList]); DExtList := TStringList.Create;