[False][3.3] RunCommand not return outputstring lazarus / 62-General ---------------------------------------------------------------------- Zaher · 2020-05-02 02:19 In Windows 8.1 i am testing (also win10), in fpc 3.3.1 Getting output of console project by using TProcess, It hang on reading from pipe, to test it just use RunCommand with small exe (you can build pascal with hello world), it hang and without result of output string. while it is work find in fpc 3.0.4 Please test it and confirm maybe I am wrong. After digging in process.pp of 3.3.1, I found the problem in Code: [Select]Function GetCreationFlags(P : TProcessnamemacro) : Cardinal; begin   With P do     begin     Result:=CREATE_UNICODE_ENVIRONMENT;     if poNoConsole in Options then       Result:=Result or CREATE_NO_WINDOW; <- here     if poNewConsole in Options then       Result:=Result or Create_new_console;     if poNewProcessGroup in Options then       Result:=Result or CREATE_NEW_PROCESS_GROUP;     If poRunSuspended in Options Then       Result:=Result or Create_Suspended;     if poDebugProcess in Options Then       Result:=Result or DEBUG_PROCESS;     if poDebugOnlyThisProcess in Options Then       Result:=Result or DEBUG_ONLY_THIS_PROCESS;     if poDefaultErrorMode in Options Then       Result:=Result or CREATE_DEFAULT_ERROR_MODE;     result:=result or PriorityConstants[FProcessPriority];     end; end; Code: [Select]    if poNoConsole in Options then       Result:=Result or CREATE_NO_WINDOW; in 3.0.4 it is DETACHED_PROCESS , replacing  CREATE_NO_WINDOW with DETACHED_PROCESS solves the probelm Code: [Select]    if poNoConsole in Options then       Result:=Result or DETACHED_PROCESS; Please test before reporting a bug ---------------------------------------------------------------------- Bi0T1N · 2020-05-02 08:17 I didn't test it but the change was done because of #32055. I assume your problem is due to missing setup of the standard handles with the changed flag: "Therefore, the console handle for the application is not set." ---------------------------------------------------------------------- Zaher · 2020-05-02 13:54 Ok, I am doing more test ---------------------------------------------------------------------- Zaher · 2020-05-02 17:15 RunCommand works prefect today, maybe my brain exhausted yesterday, but still have a problem with my project that make backup for PostgreSQL using 'pg_dump.exe' that worked perfect with FPC 3.0.4 pg_dump write 'password' then my project respond the password through Input pipe handle. In 3.3 never read any from pg_dump, but when i replaced it with fake pg_dump (wrote it in pascal) , my project read it, It is a problem then in pg_dump, but this problem solved if i used DETACHED_PROCESS. ---------------------------------------------------------------------- Bi0T1N · 2020-05-02 18:01 The reason for that is probably the newly used CREATE_NO_WINDOW flag which doesn't setup the console handles like STDIN/STDOUT/STDERR and thus the RunCommand doesn't see the 'output' from pg_dump. I'd suggest to create a bug report as this seems to be a regression (if not explicitly documented in the wiki). ---------------------------------------------------------------------- Zaher · 2020-05-02 19:56 While It is special case for pg_dumb, (and maybe some other projects like it) I am thinking to ask by feature request to add DETACHED_PROCESS as DETACHED_PROCESS as poDetached flag. this a useful article Exact meaning of console creation flags ---------------------------------------------------------------------- marcov · 2020-05-02 20:06 r45228 ---------------------------------------------------------------------- Zaher · 2020-05-02 20:15 Quote from: marcov on May 02, 2020, 10:06:41 pmr45228 Thank you