Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
fix: use absolute path to sf bin
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 9, 2021
1 parent 8e43bed commit c799408
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/run-sf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
const cp = require('child_process');
const path = require('path');

const sfPath = path.join('node_modules', '.bin', 'sf')
function trimUntil(fsPath, part) {
const parts = fsPath.split(path.sep);
const partIndex = parts.findIndex((p) => part === p);
if (partIndex === -1) return fsPath;
return parts.slice(0, partIndex + 1).join(path.sep);
}

cp.spawn(sfPath, process.argv.slice(2), { stdio: 'inherit' })
const modulePath = require.resolve('@salesforce/cli');
const sfPath = path.join(trimUntil(modulePath, 'cli'), 'bin', 'run');
cp.spawn(sfPath, process.argv.slice(2), { stdio: 'inherit' });

0 comments on commit c799408

Please sign in to comment.