Output of Program executed with Run() is not handled ion AmigaOS 3

Discuss any general programming issues here
Post Reply
amiga23
Posts: 33
Joined: Thu Jan 30, 2014 6:01 pm

Output of Program executed with Run() is not handled ion AmigaOS 3

Post by amiga23 »

Output of a program executed on AmigaOS3 with Run() does not call the RunOutput event handler.

Code: Select all

Function p_printoutput(msg)
	ConsolePrint("\n---printoutput---")
	ConsolePrint(msg.Output)
EndFunction

Function p_printreturncode(msg)
	;ForEach(msg, DebugPrint)
	ConsolePrint("\n---printreturncode---\nReturnCode:",msg.ReturnCode)
EndFunction

InstallEventHandler({RunOutput=p_printoutput, RunFinished=p_printreturncode})
Run("C:Type", "S:Startup-sequence",{ReturnCode=True})
Repeat
	WaitEvent()
Forever
Code example "borowed" from here: viewtopic.php?p=19653#p19653

If I do not install a RunOutput EventHandler, the output is displayed on the terminal I start the program from. If I do install the RunOutput EventHandler, the output is not printed to the terminal and the RunOutput EventHandler p_printoutput is not called.

Tested on AmigaOS 3.2.2.1 with Hollywood 10.0 run from AmigaShell and from CubicIDE.

Works fine on GNU/Linux (Tested on latest Manjaro with Hollywood 10.0)

Thank you very much for the improvements you already made to the Run() function.
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Output of Program executed with Run() is not handled ion AmigaOS 3

Post by airsoftsoftwair »

Yes, I can confirm this even though it's surprising me. I surely tested this on OS3 when I first implemented it. Must have got broken when I made some changes to the code later. Thanks for reporting!
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Output of Program executed with Run() is not handled ion AmigaOS 3

Post by airsoftsoftwair »

Actually, it's not a bug. "RunOutput" currently doesn't work on OS3 because OS3's queue-handler doesn't support checking if there's data in a pipe which is essential for catching the output of programs. On OS4/MorphOS/AROS the queue-handler supports this but unfortunately not on OS3 but since OS3 is in active development again chances are good that the queue-handler will be fixed. The limitation is also mentioned in the history entry for Hollywood 9.0:
- New: Added "RunOutput" event handler; this can be used to capture the output of programs started using
Run(); note that output will normally not be delivered in real-time because of stdio buffering but
if the external program continually outputs text it will arrive pretty instantly at your "RunOutput"
callback; note that due to OS limitations, this is currently unsupported on AmigaOS 3.x; MorphOS
users require at least MorphOS 3.12; by default, the output will be converted to the current default
encoding; if you don't want that, set the new optional "RawMode" argument to TRUE to get the program's
raw output
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Output of Program executed with Run() is not handled ion AmigaOS 3

Post by airsoftsoftwair »

Finally also available for OS3!

Code: Select all

- New [OS3]: The "RunOutput" event handler is now also supported on classic AmigaOS 3; this was previously
  unimplemented because of limitation of OS3's queue handler; Hollywood uses a workaround for that now 
Post Reply