@@ -984,10 +984,13 @@ static bool IsVolatileArg(const string &arg) {
984
984
}
985
985
986
986
// Returns true if the server needs to be restarted to accommodate changes
987
- // between the two argument lists.
987
+ // between the two argument lists. Populates old_server_options and
988
+ // new_server_options.
988
989
static bool AreStartupOptionsDifferent (
989
990
const vector<string> &running_server_args,
990
- const vector<string> &requested_args) {
991
+ const vector<string> &requested_args,
992
+ vector<string> *old_server_options,
993
+ vector<string> *new_server_options) {
991
994
// We need not worry about one side missing an argument and the other side
992
995
// having the default value, since this command line is the canonical one for
993
996
// this version of Bazel: either the default value is listed explicitly or it
@@ -1035,13 +1038,15 @@ static bool AreStartupOptionsDifferent(
1035
1038
" included in the current request:" ;
1036
1039
for (const string &a : old_args) {
1037
1040
BAZEL_LOG (INFO) << " " << a;
1041
+ old_server_options->push_back (a);
1038
1042
}
1039
1043
}
1040
1044
if (!new_args.empty ()) {
1041
1045
BAZEL_LOG (INFO) << " Args from the current request that were not "
1042
1046
" included when creating the server:" ;
1043
1047
for (const string &a : new_args) {
1044
1048
BAZEL_LOG (INFO) << " " << a;
1049
+ new_server_options->push_back (a);
1045
1050
}
1046
1051
}
1047
1052
@@ -1072,11 +1077,31 @@ static bool KillRunningServerIfDifferentStartupOptions(
1072
1077
// These strings contain null-separated command line arguments. If they are
1073
1078
// the same, the server can stay alive, otherwise, it needs shuffle off this
1074
1079
// mortal coil.
1075
- if (AreStartupOptionsDifferent (old_arguments, server_exe_args)) {
1080
+ vector<string> old_server_options;
1081
+ vector<string> new_server_options;
1082
+ if (AreStartupOptionsDifferent (old_arguments, server_exe_args,
1083
+ &old_server_options,
1084
+ &new_server_options)) {
1076
1085
logging_info->restart_reason = NEW_OPTIONS;
1077
- BAZEL_LOG (WARNING) << " Running " << startup_options.product_name
1078
- << " server needs to be killed, because the startup "
1079
- " options are different." ;
1086
+
1087
+ string different_startup_options_message;
1088
+
1089
+ string old_options_str;
1090
+ blaze_util::JoinStrings (old_server_options, ' ' , &old_options_str);
1091
+ different_startup_options_message +=
1092
+ " \n - Only in old server: " + old_options_str;
1093
+
1094
+ string new_options_str;
1095
+ blaze_util::JoinStrings (new_server_options, ' ' , &new_options_str);
1096
+ different_startup_options_message +=
1097
+ " \n - Only in new server: " + new_options_str;
1098
+
1099
+ BAZEL_LOG (WARNING)
1100
+ << " Running " << startup_options.product_name
1101
+ << " server needs to be killed, because the following startup "
1102
+ " options are different:"
1103
+ << different_startup_options_message;
1104
+
1080
1105
server->KillRunningServer ();
1081
1106
return true ;
1082
1107
}
0 commit comments