Skip to content

Commit 9381f01

Browse files
fix: pass in toolchain when requesting context, and log output
1 parent cc0f229 commit 9381f01

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

dist/index.js

+9-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/clippy.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,34 @@ interface ClippyResult {
1717
exitCode: number;
1818
}
1919

20-
async function buildContext(program: Program): Promise<Context> {
20+
async function buildContext(program: Program, toolchain: string | undefined): Promise<Context> {
2121
const context: Context = {
2222
cargo: "",
2323
clippy: "",
2424
rustc: "",
2525
};
2626

27+
toolchain = `+${toolchain}` ?? "";
28+
2729
await Promise.all([
28-
await exec.exec("rustc", ["-V"], {
29-
silent: true,
30+
await exec.exec("rustc", [toolchain, "-V"], {
31+
silent: false,
3032
listeners: {
3133
stdout: (buffer: Buffer) => {
3234
return (context.rustc = buffer.toString().trim());
3335
},
3436
},
3537
}),
36-
await program.call(["-V"], {
37-
silent: true,
38+
await program.call([toolchain, "-V"], {
39+
silent: false,
3840
listeners: {
3941
stdout: (buffer: Buffer) => {
4042
return (context.cargo = buffer.toString().trim());
4143
},
4244
},
4345
}),
44-
await program.call(["clippy", "-V"], {
45-
silent: true,
46+
await program.call([toolchain, "clippy", "-V"], {
47+
silent: false,
4648
listeners: {
4749
stdout: (buffer: Buffer) => {
4850
return (context.clippy = buffer.toString().trim());
@@ -99,7 +101,7 @@ function getProgram(useCross: boolean): Promise<Program> {
99101
export async function run(actionInput: input.ParsedInput): Promise<void> {
100102
const program: Program = await getProgram(actionInput.useCross);
101103

102-
const context = await buildContext(program);
104+
const context = await buildContext(program, actionInput.toolchain);
103105

104106
const { stats, annotations, exitCode } = await runClippy(actionInput, program);
105107

0 commit comments

Comments
 (0)