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
Original file line numberDiff line numberDiff line change
@@ -91156,31 +91156,32 @@ const exec = __importStar(__nccwpck_require__(1514));
9115691156
const core_1 = __nccwpck_require__(4543);
9115791157
const outputParser_1 = __nccwpck_require__(3237);
9115891158
const reporter_1 = __nccwpck_require__(5021);
91159-
async function buildContext(program) {
91159+
async function buildContext(program, toolchain) {
9116091160
const context = {
9116191161
cargo: "",
9116291162
clippy: "",
9116391163
rustc: "",
9116491164
};
91165+
toolchain = `+${toolchain}` ?? 0;
9116591166
await Promise.all([
91166-
await exec.exec("rustc", ["-V"], {
91167-
silent: true,
91167+
await exec.exec("rustc", [toolchain, "-V"], {
91168+
silent: false,
9116891169
listeners: {
9116991170
stdout: (buffer) => {
9117091171
return (context.rustc = buffer.toString().trim());
9117191172
},
9117291173
},
9117391174
}),
91174-
await program.call(["-V"], {
91175-
silent: true,
91175+
await program.call([toolchain, "-V"], {
91176+
silent: false,
9117691177
listeners: {
9117791178
stdout: (buffer) => {
9117891179
return (context.cargo = buffer.toString().trim());
9117991180
},
9118091181
},
9118191182
}),
91182-
await program.call(["clippy", "-V"], {
91183-
silent: true,
91183+
await program.call([toolchain, "clippy", "-V"], {
91184+
silent: false,
9118491185
listeners: {
9118591186
stdout: (buffer) => {
9118691187
return (context.clippy = buffer.toString().trim());
@@ -91229,7 +91230,7 @@ function getProgram(useCross) {
9122991230
}
9123091231
async function run(actionInput) {
9123191232
const program = await getProgram(actionInput.useCross);
91232-
const context = await buildContext(program);
91233+
const context = await buildContext(program, actionInput.toolchain);
9123391234
const { stats, annotations, exitCode } = await runClippy(actionInput, program);
9123491235
await new reporter_1.Reporter().report(stats, annotations, context);
9123591236
if (exitCode !== 0) {

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)