clipshot 1.0.6 → 1.0.7
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/dist/index.js +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -141,16 +141,30 @@ function uninstall() {
|
|
|
141
141
|
}
|
|
142
142
|
function stopBackground() {
|
|
143
143
|
try {
|
|
144
|
-
//
|
|
144
|
+
// First check if any processes are running
|
|
145
145
|
const result = (0, child_process_1.execSync)("pgrep -f 'node.*[c]lipshot.*--daemon'", { encoding: "utf8" });
|
|
146
146
|
const pids = result.trim().split("\n").filter(Boolean);
|
|
147
|
-
for (const pid of pids) {
|
|
148
|
-
process.kill(parseInt(pid), "SIGTERM");
|
|
149
|
-
console.log(`Stopped process ${pid}`);
|
|
150
|
-
}
|
|
151
147
|
if (pids.length === 0) {
|
|
152
148
|
console.log("No clipshot process running");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Use pkill for reliable process termination
|
|
152
|
+
try {
|
|
153
|
+
(0, child_process_1.execSync)("pkill -f 'node.*clipshot.*--daemon'", { encoding: "utf8" });
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// pkill returns non-zero even on success sometimes
|
|
157
|
+
}
|
|
158
|
+
// Verify they're stopped
|
|
159
|
+
try {
|
|
160
|
+
(0, child_process_1.execSync)("pgrep -f 'node.*[c]lipshot.*--daemon'", { encoding: "utf8" });
|
|
161
|
+
// If we get here, some processes survived - try SIGKILL
|
|
162
|
+
(0, child_process_1.execSync)("pkill -9 -f 'node.*clipshot.*--daemon'", { encoding: "utf8" });
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// No processes found - good
|
|
153
166
|
}
|
|
167
|
+
console.log(`Stopped ${pids.length} process(es)`);
|
|
154
168
|
}
|
|
155
169
|
catch {
|
|
156
170
|
console.log("No clipshot process running");
|