Hi,
I found the trouble maker:
Code: Select all
Prog = RunProgram("cmd", "", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write)
If IsProgram(Prog)
Counter = 0
While ProgramRunning(Prog)
Delay(1)
Counter + 1
Debug Counter
If Counter = 3000
WriteProgramStringN(Prog, "exit")
Debug "Exit"
Stdout.a = 0
Repeat
Bytes = AvailableProgramOutput(Prog)
If Bytes
ReadProgramData(Prog, @Stdout, 1)
Debug Chr(Stdout)
EndIf
Until Bytes = 0
EndIf
Wend
CloseProgram(Prog)
EndIf
The program is somehow still active for PB if there is data to read.
If the data buffer is read out, ProgrammRunning() terminates as expected.
Bernd
P.S.: I'm not sure if this is a bug or to less documentation in the help.
But even SysInternals ProcessExplorer shows that cmd is finished.
And still it is running for PB.