Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Reload Script

Table of contents

yt_run_ReloadScript

int yt_run_ReloadScript(const char* flag_file_name, const char* reload_file_name, const char* script_name);
  • Usage: Start reloading script phase when <flag_file_name> file is detected, or an error occurred when running inline functions. libyt starts reloading the script <script_name> if <reload_file_name> file is detected, and it exits the API if <reload_file_name>_EXIT file is detected. Outputs will be printed in <reload_file_name>_SUCCESS or <reload_file_name>_FAILED.
  • Return:
    • YT_SUCCESS
    • YT_FAIL: When libyt is not compiled with -DINTERACTIVE_MODE, it returns YT_FAIL.

:information_source: Must compile libyt with -DINTERACTIVE_MODE.

Example

The code will stop and enter reloading script phase, if LIBYT_STOP is detected or an inline function failed. It will reload test_reload.py when detected RELOAD, and it will exit the API once RELOAD_EXIT is detected. Output results will be printed in <reload_file_name>_SUCCESS or <reload_file_name>_FAILED. See Reloading Script for details.

#include "libyt.h"
...
if (yt_run_ReloadScript("LIBYT_STOP", "RELOAD", "test_reload.py") != YT_SUCCESS) {
    fprintf(stderr, "ERROR: yt_run_ReloadScript failed!\n");
    exit(EXIT_FAILURE);
}