ReadProgramError() works in V6.01 but not in V6.02

Just starting out? Need help? Post your questions and find answers here.
BarJo
New User
New User
Posts: 1
Joined: Fri May 26, 2023 9:58 am

ReadProgramError() works in V6.01 but not in V6.02

Post by BarJo »

Hello a team,

I have detected a disfonctionnements on previous version 6.01 and the last 6.02.

the bug is present on function ReadProgramError.
err:
[C:/purebasic/svn/v5.80/Libraries/Process/Windows/ReadProgramError.c:29] NbAvailableBytes = 0
err:
[C:/purebasic/svn/v5.80/Libraries/Process/Windows/ReadProgramError.c:29] NbAvailableBytes = 0
err:
[C:/purebasic/svn/v5.80/Libraries/Process/Windows/ReadProgramError.c:29] NbAvailableBytes = 0
err:
Press any key to continue...
This code is functional on 6.01 and not functional on 6.02:

Code: Select all

Define timeout, Start, pid, RetSTD.s, RetERR.s, racine.s

  timeout = 10
  Start = Date() + timeout
  racine = GetEnvironmentVariable("comspec")
  
If OpenConsole()
pid = RunProgram(racine, " /s /c dir *.*","" , #PB_Program_Hide | #PB_Program_Open | #PB_Program_Error | #PB_Program_Read)
  While ProgramRunning(pid)
    If AvailableProgramOutput(pid)
      ;RetSTD + ReadProgramString(pid) + Chr(13)
      RetERR + ReadProgramError(pid) + Chr(13)
    EndIf
    ;PrintN("std:" + RetSTD)
    PrintN("err:" + RetERR)
    If Date() > Start
      Break
    EndIf
    Delay(100)
  Wend
  
  PrintN("Press any key to continue...") 
  While Inkey() = ""
    Delay(10)
  Wend
  CloseConsole()
EndIf

Barjo.

// Moved from "Bugs - Windows" to "Coding Questions"; Subject adjusted (Kiffi)
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [c:/purebasic/svn/v5.80/Libraries/Process/windows/ReadProgramError.c:29]

Post by mk-soft »

Work here fine

PB: v6.02
OS: Windows 10 22H2
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
fryquez
Enthusiast
Enthusiast
Posts: 369
Joined: Mon Dec 21, 2015 8:12 pm

Re: ReadProgramError() works in V6.01 but not in V6.02

Post by fryquez »

You have to compile it as Console, to see that it prints "ReadProgramError.c:29] NbAvailableBytes = 0".

BTW: AvailableProgramOutput() only check the stdout pipe, there is no counterpart for stderr.
So AvailableProgramOutput() is useless, if one expects data for ReadProgramError().
Post Reply