clipshot 1.0.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +23 -9
  2. package/package.json +5 -1
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ Run without command to setup/configure.
119
119
  function uninstall() {
120
120
  // Stop any running process
121
121
  try {
122
- const result = (0, child_process_1.execSync)("pgrep -f 'node.*[s]hotmon.*--daemon'", { encoding: "utf8" });
122
+ const result = (0, child_process_1.execSync)("pgrep -f 'node.*[c]lipshot.*--daemon'", { encoding: "utf8" });
123
123
  const pids = result.trim().split("\n").filter(Boolean);
124
124
  for (const pid of pids) {
125
125
  process.kill(parseInt(pid), "SIGTERM");
@@ -141,16 +141,30 @@ function uninstall() {
141
141
  }
142
142
  function stopBackground() {
143
143
  try {
144
- // Use bracket trick to avoid pgrep matching itself
145
- const result = (0, child_process_1.execSync)("pgrep -f 'node.*[s]hotmon.*--daemon'", { encoding: "utf8" });
144
+ // First check if any processes are running
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");
@@ -159,7 +173,7 @@ function stopBackground() {
159
173
  function showStatus() {
160
174
  try {
161
175
  // Use bracket trick to avoid pgrep matching itself
162
- const result = (0, child_process_1.execSync)("pgrep -af 'node.*[s]hotmon.*--daemon'", { encoding: "utf8" });
176
+ const result = (0, child_process_1.execSync)("pgrep -af 'node.*[c]lipshot.*--daemon'", { encoding: "utf8" });
163
177
  const lines = result.trim().split("\n").filter(Boolean);
164
178
  if (lines.length > 0) {
165
179
  for (const line of lines) {
@@ -230,7 +244,7 @@ async function startCommand() {
230
244
  }
231
245
  // Stop any existing process before starting new one
232
246
  try {
233
- const result = (0, child_process_1.execSync)("pgrep -f 'node.*[s]hotmon.*--daemon'", { encoding: "utf8" });
247
+ const result = (0, child_process_1.execSync)("pgrep -f 'node.*[c]lipshot.*--daemon'", { encoding: "utf8" });
234
248
  const pids = result.trim().split("\n").filter(Boolean);
235
249
  for (const pid of pids) {
236
250
  process.kill(parseInt(pid), "SIGTERM");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clipshot",
3
- "version": "1.0.2",
3
+ "version": "1.0.7",
4
4
  "description": "Screenshot monitor CLI tool",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -17,6 +17,10 @@
17
17
  ],
18
18
  "author": "",
19
19
  "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/HendrikYtt/clipshot.git"
23
+ },
20
24
  "devDependencies": {
21
25
  "@types/node": "^25.0.10",
22
26
  "typescript": "^5.9.3"