Skip to content

Commit

Permalink
rules: Use BUCK_SCRATCH_PATH in rustc_action.py
Browse files Browse the repository at this point in the history
Summary: This directory is unique to the action and gets cleaned up even in cases of non-graceful exits, so avoids these kinds of problems

Reviewed By: zertosh, dtolnay

Differential Revision: D66395294

fbshipit-source-id: 9e12bdb2f890912a6ad05a8bd6cc272c243a57d3
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Nov 23, 2024
1 parent 9912d47 commit 080a7cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rust/tools/rustc_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async def handle_output( # noqa: C901
return got_error_diag


async def main() -> int:
async def main() -> int: # noqa: C901
args = arg_parse()

if args.echo:
Expand Down Expand Up @@ -312,6 +312,9 @@ async def main() -> int:
prefix="rustc-args-",
suffix=".txt",
delete=False,
# This isn't set when running doctests. Once that's fixed, we won't need
# `tempfile`
dir=os.environ.get("BUCK_SCRATCH_PATH", None),
) as args_file:
args_file.write("\n".join(rustc_args).encode() + b"\n")
args_file.flush()
Expand Down

0 comments on commit 080a7cc

Please sign in to comment.