|
21 | 21 |
|
22 | 22 | #include "node.h" |
23 | 23 | #include "node_dotenv.h" |
| 24 | +#include "node_task_runner.h" |
24 | 25 |
|
25 | 26 | // ========== local headers ========== |
26 | 27 |
|
@@ -409,10 +410,6 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) { |
409 | 410 | return StartExecution(env, "internal/main/watch_mode"); |
410 | 411 | } |
411 | 412 |
|
412 | | - if (!env->options()->run.empty()) { |
413 | | - return StartExecution(env, "internal/main/run"); |
414 | | - } |
415 | | - |
416 | 413 | if (!first_argv.empty() && first_argv != "-") { |
417 | 414 | return StartExecution(env, "internal/main/run_main_module"); |
418 | 415 | } |
@@ -1059,6 +1056,21 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, |
1059 | 1056 | } |
1060 | 1057 | } |
1061 | 1058 |
|
| 1059 | + if (!per_process::cli_options->run.empty()) { |
| 1060 | + // Check if "--no-warnings" is passed to suppress the warning. |
| 1061 | + if (std::find(args.begin(), args.end(), "--no-warnings") == args.end()) { |
| 1062 | + fprintf(stderr, |
| 1063 | + "ExperimentalWarning: Task runner is an experimental feature and " |
| 1064 | + "might change at any time\n\n"); |
| 1065 | + } |
| 1066 | + |
| 1067 | + auto positional_args = task_runner::GetPositionalArgs(args); |
| 1068 | + result->early_return_ = true; |
| 1069 | + task_runner::RunTask( |
| 1070 | + &result, per_process::cli_options->run, positional_args); |
| 1071 | + return result; |
| 1072 | + } |
| 1073 | + |
1062 | 1074 | if (!(flags & ProcessInitializationFlags::kNoPrintHelpOrVersionOutput)) { |
1063 | 1075 | if (per_process::cli_options->print_version) { |
1064 | 1076 | printf("%s\n", NODE_VERSION); |
|
0 commit comments