yt_run_ReloadScript – Reload Script

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.

Must compile libyt with -DINTERACTIVE_MODE=ON.

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 RELOAD file is detected, and it will exit the API once RELOAD_EXIT is detected. Output results will be printed in RELOAD_SUCCESS or RELOAD_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);
}