Skip to content

Commit

Permalink
fix: execubale path
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnnnn committed Aug 26, 2024
1 parent 1818ba8 commit 543667e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
13 changes: 8 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63745,7 +63745,7 @@ var tool_cache = __toESM(require_tool_cache(), 1);
var cache = __toESM(require_cache2(), 1);
var import_semver = __toESM(require_semver3(), 1);
import {existsSync, readFileSync as readFileSync3, chmodSync} from "fs";
import {join} from "path";
import {join, dirname} from "path";
async function run() {
try {
checkPlatformCompatibility();
Expand Down Expand Up @@ -63780,7 +63780,10 @@ async function run() {
const installedPath = await installFlutterGen(version, cacheEnabled, cacheKey, cachePath);
core2.info(`FlutterGen installed: ${installedPath}`);
await makeExecutable(installedPath);
await execa("fluttergen", ["--version"], { stdio: "inherit" });
const { stdout } = await execa("fluttergen", ["--version"]);
if (stdout !== `FlutterGen v${version}`) {
throw new Error(`commnad doesn't work as expected: ${stdout}`);
}
core2.setOutput("version", version);
} catch (error2) {
if (error2 instanceof Error) {
Expand Down Expand Up @@ -63835,9 +63838,9 @@ async function installFlutterGen(version, cacheEnabled, cacheKey, cachePath) {
}
async function makeExecutable(installedPath) {
const fluttergenPath = join(installedPath, "fluttergen");
chmodSync(fluttergenPath, 755);
core2.addPath(installedPath);
chmodSync(fluttergenPath, "755");
core2.addPath(dirname(fluttergenPath));
}
run();

//# debugId=2ECF789E3C76642064756E2164756E21
//# debugId=882A08D3CC4BC75964756E2164756E21
6 changes: 3 additions & 3 deletions dist/index.js.map

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getInput, setOutput, setFailed, info, addPath } from '@actions/core';
import { downloadTool, extractTar } from '@actions/tool-cache';
import { restoreCache, saveCache } from '@actions/cache';
import { existsSync, readFileSync, chmodSync } from 'fs';
import { join } from 'path';
import { join, dirname } from 'path';
import { valid } from 'semver';

async function run() {
Expand Down Expand Up @@ -50,7 +50,10 @@ async function run() {

await makeExecutable(installedPath);

await execa('fluttergen', ['--version'], { stdio: 'inherit' });
const { stdout } = await execa('fluttergen', ['--version']);
if (stdout !== `FlutterGen v${version}`) {
throw new Error(`commnad doesn't work as expected: ${stdout}`);
}

setOutput('version', version);
} catch (error) {
Expand Down Expand Up @@ -120,8 +123,8 @@ async function installFlutterGen(

async function makeExecutable(installedPath: string): Promise<void> {
const fluttergenPath = join(installedPath, 'fluttergen');
chmodSync(fluttergenPath, 755);
addPath(installedPath);
chmodSync(fluttergenPath, '755');
addPath(dirname(fluttergenPath));
}

run();

0 comments on commit 543667e

Please sign in to comment.