Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NobodyXu authored Jun 15, 2024
1 parent cef8ea2 commit a0ef72d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {promises as fs} from 'fs';
import {join, normalize, resolve} from 'path';
import * as stream from 'stream'

import {
setFailed,
Expand Down Expand Up @@ -450,6 +451,11 @@ function render(template: string, vars: TemplateVars): string {
return _render(template, vars);
}

async function openDevNullWritable(): Promise<stream.Writable> {
const file = await fs.open("/dev/null");
return file.createWriteStream();
}

async function execAndSucceed(
program: string,
args: string[],
Expand All @@ -467,8 +473,8 @@ async function toolExists(name: string): Promise<boolean> {
name,
['--help'],
{
outStream: fs.createWriteStream('/dev/null'),
errStream: fs.createWriteStream('/dev/null'),
outStream: await openDevNullWritable(),
errStream: await openDevNullWritable(),
},
);
debug(`program exited with code ${code}`);
Expand Down

0 comments on commit a0ef72d

Please sign in to comment.