Skip to content

Commit fdb23ef

Browse files
author
Noriaki Rakuyama
committed
fix: convert linux file path to Windows one in WSL
1 parent 932bbfc commit fdb23ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/commands/org/open.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import path from 'node:path';
99
import { platform, tmpdir } from 'node:os';
1010
import fs from 'node:fs';
11+
import { execSync } from 'node:child_process';
1112
import {
1213
Flags,
1314
loglevel,
@@ -140,7 +141,10 @@ export class OrgOpenCommand extends SfCommand<OrgOpenOutput> {
140141
flags.path ? decodeURIComponent(flags.path) : retUrl
141142
)
142143
);
143-
const cp = await utils.openUrl(`file:///${tempFilePath}`, {
144+
const filePathUrl = isWsl
145+
? 'file:///' + execSync(`wslpath -m ${tempFilePath}`).toString().trim()
146+
: `file:///${tempFilePath}`;
147+
const cp = await utils.openUrl(filePathUrl, {
144148
...(flags.browser ? { app: { name: apps[flags.browser] } } : {}),
145149
...(flags.private ? { newInstance: platform() === 'darwin', app: { name: apps.browserPrivate } } : {}),
146150
});

0 commit comments

Comments
 (0)