Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@deltachat/stdio-rpc-server): fix version check when deltachat-rpc-server is found in path #5579

Merged
merged 4 commits into from
May 17, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions deltachat-rpc-server/npm-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,19 @@ export async function getRPCServerPath(

const { stdout: executable } =
os.platform() !== "win32"
? await exec("command", ["-v", PATH_EXECUTABLE_NAME])
: await exec("where", [PATH_EXECUTABLE_NAME]);
? await exec("command", ["-v", PATH_EXECUTABLE_NAME], { shell: true })
: await exec("where", [PATH_EXECUTABLE_NAME], { shell: true });

// by just trying to execute it and then use "command -v deltachat-rpc-server" (unix) or "where deltachat-rpc-server" (windows) to get the path to the executable
if (executable.length > 1) {
// test if it is the right version
try {
// for some unknown reason it is in stderr and not in stdout
const { stderr } = await promisify(execFile)(executable, ["--version"]);
const { stderr } = await promisify(execFile)(
executable,
["--version"],
{ shell: true }
);
const version = stderr.slice(0, stderr.indexOf("\n"));
if (package_json.version !== version) {
throw new Error(
Expand Down
Loading