[Select]

Core


Index

 

OS_ChangeRedirection

The OS_ChangeRedirection SWI can be used to change the default input (vector RdchV and OS_Byte &81) and output (vector WrchV and all callers) streams used by the operating system. The Kernel has been updated to better support nested invocation of commands with redirection in place. This is known as 'managed redirection'. Clients are required to perform the management of the redirection where previously this would be handled automatically by the Kernel.

Prior to Kernel 8.75, the operating system would immediately override the redirection and close the associated files when an OS_Exit was issued. Kernel 8.75 and later will no longer perform any additional behaviour on OS_Exit with regard to the redirection.

In addition, the redirection file handles would be closed and redirection disabled when an error occurred on the stream. Kernel versions after 8.59 will no longer close the files or restore redirection. Instead, only a single operation will take place, either writing a character to the regular VDU stream, or reading a character from the keyboard, as was previously the case.

Clients which are reliant on redirection being terminated by an OS_Exit will need to be updated to install environment handlers, or otherwise ensure that the files are closed correctly on return from the operation which required redirection. The only operating system component which is affected by this is CLIV. The CLIV module will install its own environment handlers sufficient to undo command line redirection on return from a command's execution.

C-based applications should need to take no additional actions where they use the called CLI commands together with manual redirection of streams. However, where the chained CLI commands are used (that is, by _kernel_system with the 'chain' flag set, or by system with the 'CHAIN:' prefix) and the redirection is manually imposed, it will be necessary to update the application to use a call and to restore the redirection file handles on return from the command.


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holders permission. RISC OS is subject to continuous development and improvement as such all information is reproduced by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version 1.03 3rd November 2015