Opening a console program with tprocess lazarus / 21-General ---------------------------------------------------------------------- calebs · 2021-12-23 00:31 Hello all, i have a graphical application (could be windows / linux) and i've created a  console application to update the programs. How do i start the console app from a graphical application? I've used tprocess with podetached option to start another graphical application and worked as expected, started new app and closes parent leaving child running. That worked on windows and linux. Now, i want to use the same method to call a console application but is not working if i add podetached, the console application never shows, if i remove, the chidl opens but when i close the parent it closes the child also (and i want to update the main app to). Is any way to start a detached console process? THanks! ---------------------------------------------------------------------- trev · 2021-12-23 01:15 This works on Unix: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Program Example; Uses  Process; Var  Aprocess: TProcess; begin  WriteLn('Executing sleep 60');  Aprocess := TProcess.Create(Nil);  AProcess.Executable := '/bin/sh';  AProcess.Parameters.Add('-c');  AProcess.Parameters.Add('sleep 60');  AProcess.Execute;  AProcess.Free;  WriteLn('Program exiting...');end. The program finishes but 'sleep 60' is still running. ---------------------------------------------------------------------- marcov · 2021-12-23 12:15 Use runcommand() ---------------------------------------------------------------------- calebs · 2021-12-23 12:39 Quote from: trev on December 23, 2021, 02:15:06 amThis works on Unix: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Program Example; Uses  Process; Var  Aprocess: TProcess; begin  WriteLn('Executing sleep 60');  Aprocess := TProcess.Create(Nil);  AProcess.Executable := '/bin/sh';  AProcess.Parameters.Add('-c');  AProcess.Parameters.Add('sleep 60');  AProcess.Execute;  AProcess.Free;  WriteLn('Program exiting...');end. The program finishes but 'sleep 60' is still running. thanks trev, i will try but i don't know if that will work because the console program copy several executables including the one that calls the console updater and i need the graphical app be closed to copy the updated file overwriting it and if it is running it will give an error. At least in windows will do for sure. ---------------------------------------------------------------------- calebs · 2021-12-23 12:41 Quote from: marcov on December 23, 2021, 01:15:58 pmUse runcommand() thanks marcov, i used runcommand before, i've stop using it after i read that it will be discontinued on future versions of lazarus / fpc and tprocess was recommended way. I guess i'll be back to it if there is no solution to this problem ---------------------------------------------------------------------- winni · 2021-12-23 13:38 Hi! Only the old style runcommand is deprecated: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RunCommand(const cmdline:TProcessString;out outputstring:string):boolean; deprecated;   The new style runcommand is NOT deprecated so you can use it: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function RunCommand(const exename:TProcessString;const commands:array of TProcessString;out outputstring:string; Options : TProcessOptions = [];SWOptions:TShowWindowOptions=swoNone):boolean;               Winni ---------------------------------------------------------------------- calebs · 2021-12-26 22:23 It worked with runcommand but not in depuration... it wasnt working while im debugging but runned the executable standalone and works. I't must be something with lazfpdebug... i remember now that i have some problems before with fpdebug but not with gdb... at least on 2.0.x with tprocess and call executables Thanks!