Page 1 of 1
Execute with CaptureOutput set to true doesn't returns rc
Posted: Tue Sep 08, 2026 3:18 pm
by bitRocky
Execute() should return the rc of the program which gets executed if CaptureOutput is set to true, but it doesn't work here on MorphOS.
It always returns 0.
Did I something wrong?
Here is an example with tries to execute an unknown command "Echo2".
Code: Select all
@VERSION 11,0
rc, out = Execute("Echo2", "Hallo", {CaptureOutput=True})
DebugPrint("rc = "..rc)
DebugPrint("out = "..out)
If rc = 0
DebugPrint("Successful")
Else
DebugPrint("Failed!")
Endif
Re: Execute with CaptureOutput set to true doesn't returns rc
Posted: Tue Sep 08, 2026 3:34 pm
by plouf
Do you have latest hollywood11?
Some fixes have been made for this
Relative discusion ->
https://forums.hollywood-mal.com/viewtopic.php?t=4225
Re: Execute with CaptureOutput set to true doesn't returns rc
Posted: Tue Sep 08, 2026 4:30 pm
by bitRocky
Yes v11 here on MorphOS
Re: Execute with CaptureOutput set to true doesn't returns rc
Posted: Tue Sep 08, 2026 9:40 pm
by plouf
try the following example i test it in mos now works
comment/uncomment the two
Run()
Code: Select all
Function p_HandlerFunc(msg)
Switch(msg.action)
Case "RunFinished":
NPrint("Return code "..StrStr(msg.returncode))
NPrint("Press Return to continue.")
WaitLeftMouse()
EndSwitch
EndFunction
InstallEventHandler({RunFinished = p_HandlerFunc})
;Run("ed","",{Returncode=True}) ; returncode 0
Run("sss","",{Returncode=True}) ; dont exist not return code in win / returncode 10 in amigaos
Repeat
WaitEvent
Forever
Re: Execute with CaptureOutput set to true doesn't returns rc
Posted: Tue Sep 08, 2026 9:50 pm
by bitRocky
I wanted to use Execute (), because it didn't have to run asynchronously.
And it should work according to the docs.