Execute with CaptureOutput set to true doesn't returns rc

Find quick help here to get you started with Hollywood
Post Reply
bitRocky
Posts: 159
Joined: Fri Nov 14, 2014 6:01 pm

Execute with CaptureOutput set to true doesn't returns rc

Post 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
plouf
Posts: 751
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Execute with CaptureOutput set to true doesn't returns rc

Post 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
Christos
bitRocky
Posts: 159
Joined: Fri Nov 14, 2014 6:01 pm

Re: Execute with CaptureOutput set to true doesn't returns rc

Post by bitRocky »

Yes v11 here on MorphOS
plouf
Posts: 751
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Execute with CaptureOutput set to true doesn't returns rc

Post 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
Christos
bitRocky
Posts: 159
Joined: Fri Nov 14, 2014 6:01 pm

Re: Execute with CaptureOutput set to true doesn't returns rc

Post by bitRocky »

I wanted to use Execute (), because it didn't have to run asynchronously.
And it should work according to the docs.
Post Reply