pandash-cli 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +16 -12
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -10,7 +10,6 @@ function findApp() {
|
|
|
10
10
|
|
|
11
11
|
switch (platform) {
|
|
12
12
|
case "win32": {
|
|
13
|
-
// Check common install locations
|
|
14
13
|
const paths = [
|
|
15
14
|
path.join(process.env.LOCALAPPDATA || "", "Pandash", "pandash.exe"),
|
|
16
15
|
path.join(process.env.PROGRAMFILES || "", "Pandash", "pandash.exe"),
|
|
@@ -25,12 +24,10 @@ function findApp() {
|
|
|
25
24
|
return fs.existsSync(appPath) ? appPath : null;
|
|
26
25
|
}
|
|
27
26
|
case "linux": {
|
|
28
|
-
// Check if pandash is in PATH
|
|
29
27
|
try {
|
|
30
28
|
const result = execSync("which pandash 2>/dev/null", { encoding: "utf8" }).trim();
|
|
31
29
|
if (result) return result;
|
|
32
30
|
} catch {}
|
|
33
|
-
// Check common locations
|
|
34
31
|
const paths = [
|
|
35
32
|
"/usr/bin/pandash",
|
|
36
33
|
"/usr/local/bin/pandash",
|
|
@@ -50,16 +47,23 @@ const appPath = findApp();
|
|
|
50
47
|
|
|
51
48
|
if (!appPath) {
|
|
52
49
|
console.error(`${APP_NAME} is not installed.`);
|
|
53
|
-
console.error("Run: npm install -g pandash");
|
|
50
|
+
console.error("Run: npm install -g pandash-cli");
|
|
54
51
|
process.exit(1);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
// On Windows, use Start-Process to launch detached from console
|
|
55
|
+
// This is required because the exe uses windows_subsystem = "windows"
|
|
56
|
+
if (process.platform === "win32") {
|
|
57
|
+
spawn("cmd.exe", ["/c", "start", "", appPath, ...process.argv.slice(2)], {
|
|
58
|
+
stdio: "ignore",
|
|
59
|
+
detached: true,
|
|
60
|
+
}).unref();
|
|
61
|
+
} else {
|
|
62
|
+
const child = spawn(appPath, process.argv.slice(2), {
|
|
63
|
+
stdio: "inherit",
|
|
64
|
+
detached: true,
|
|
65
|
+
});
|
|
66
|
+
child.unref();
|
|
67
|
+
}
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
child.unref();
|
|
65
|
-
setTimeout(() => process.exit(0), 500);
|
|
69
|
+
process.exit(0);
|