Skip to content

Commit 225f8fc

Browse files
committed
Address comments
1 parent ac0f301 commit 225f8fc

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

rust/private/clippy.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, conf
203203
outputs.append(success_marker)
204204

205205
if forward_clippy_exit_code == False:
206-
args.process_wrapper_flags.add("--forward-exit-code", "false")
206+
args.process_wrapper_flags.add("--swallow-subprocess-exit-code", "true")
207207

208208
if exit_code_file != None:
209209
args.process_wrapper_flags.add("--exit-code-file", exit_code_file)

util/process_wrapper/options.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(crate) struct Options {
4444
// If set, also logs all unprocessed output from the rustc output to this file.
4545
// Meant to be used to get json output out of rustc for tooling usage.
4646
pub(crate) output_file: Option<String>,
47-
// If set, exit with the same code as the child process.
47+
// If set, exit with the same exit code as the child process if there are no internal errors.
4848
pub(crate) forward_exit_code: bool,
4949
// If set, writes the exit code of the process into this file.
5050
pub(crate) exit_code_file: Option<String>,
@@ -68,7 +68,7 @@ pub(crate) fn options() -> Result<Options, OptionError> {
6868
let mut stdout_file = None;
6969
let mut stderr_file = None;
7070
let mut output_file = None;
71-
let mut forward_exit_code_raw = None;
71+
let mut swallow_exit_code_raw = None;
7272
let mut exit_code_file = None;
7373
let mut rustc_quit_on_rmeta_raw = None;
7474
let mut rustc_output_format_raw = None;
@@ -109,9 +109,9 @@ pub(crate) fn options() -> Result<Options, OptionError> {
109109
&mut output_file,
110110
);
111111
flags.define_flag(
112-
"--forward-exit-code",
113-
"If set, the process_wrapper will exit with the same exit code as the subprocess if it had no internal errors. True by default, disable with `--forward-exit-code=false`",
114-
&mut forward_exit_code_raw,
112+
"--swallow-subprocess-exit-code",
113+
"If set, the process_wrapper will not forward the exit code for the subprocess, and instead only fail if there are internal errors.",
114+
&mut swallow_exit_code_raw,
115115
);
116116
flags.define_flag(
117117
"--exit-code-file",
@@ -195,8 +195,7 @@ pub(crate) fn options() -> Result<Options, OptionError> {
195195
})
196196
.transpose()?;
197197

198-
// As we want `true` by default, we accept anything except `"false"` as `"true"`
199-
let forward_exit_code = forward_exit_code_raw.is_some_and(|s| s != "false");
198+
let swallow_exit_code = swallow_exit_code_raw.is_some_and(|s| s != "true");
200199
let rustc_quit_on_rmeta = rustc_quit_on_rmeta_raw.is_some_and(|s| s == "true");
201200
let rustc_output_format = rustc_output_format_raw
202201
.map(|v| match v.as_str() {
@@ -245,7 +244,7 @@ pub(crate) fn options() -> Result<Options, OptionError> {
245244
stdout_file,
246245
stderr_file,
247246
output_file,
248-
forward_exit_code,
247+
forward_exit_code: !swallow_exit_code,
249248
exit_code_file,
250249
rustc_quit_on_rmeta,
251250
rustc_output_format,

0 commit comments

Comments
 (0)