diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-09 18:25:34 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-09-25 22:57:28 +0900 |
commit | 70e8a08295114fa3cb112ddb42844889f7f98eb1 (patch) | |
tree | 9528a9003ccaebf48858d74fbb0160068c8ca3eb /ruby.c | |
parent | 696f08238bc25a27e4b96c355c26bc0d27738548 (diff) | |
download | ruby-70e8a08295114fa3cb112ddb42844889f7f98eb1.tar.gz |
Add `--bugreport-path` option
It has precedence over the environment variable `RUBY_BUGREPORT_PATH`.
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -337,6 +337,7 @@ usage(const char *name, int help, int highlight, int columns) M("--backtrace-limit=num", "", "limit the maximum length of backtrace"), M("--verbose", "", "turn on verbose mode and disable script from stdin"), M("--version", "", "print the version number, then exit"), + M("--bugreport-path=TEMPLATE", "", "template of bug report files"), M("-y", ", --yydebug", "print log of parser. Backward compatibility is not guaranteed"), M("--help", "", "show this message, -h for short message"), }; @@ -1352,8 +1353,6 @@ proc_encoding_option(ruby_cmdline_options_t *opt, const char *s, const char *opt UNREACHABLE; } -static const char *test_bug_report_template; - static long proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **argv, int envopt) { @@ -1464,8 +1463,10 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char ** opt->backtrace_length_limit = n; } } - else if (is_option_with_arg("test-bugreport", true, false)) { - test_bug_report_template = s; + else if (is_option_with_arg("bugreport-path", true, true)) { + if (!opt->bugreport_path) { + opt->bugreport_path = s; + } } else { rb_raise(rb_eRuntimeError, @@ -2916,9 +2917,9 @@ ruby_process_options(int argc, char **argv) iseq = process_options(argc, argv, cmdline_options_init(&opt)); - if (test_bug_report_template) { - void ruby_test_bug_report(const char *template); - ruby_test_bug_report(test_bug_report_template); + if (opt.bugreport_path && *opt.bugreport_path) { + void ruby_set_bug_report(const char *template); + ruby_set_bug_report(opt.bugreport_path); } return (void*)(struct RData*)iseq; } |