@joystick.js/cli-canary 0.0.0-canary.646 → 0.0.0-canary.648

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.
@@ -1 +1 @@
1
- import t from"child_process";import l from"util";const o=l.promisify(t.exec),r=async(i=0)=>{process.platform==="win32"&&await o(`taskkill /F /PID ${i}`),await o(`kill -9 ${i}`)};var c=r;export{c as default};
1
+ import t from"child_process";import e from"util";const s=e.promisify(t.exec),o=async(r=0)=>{const i=parseInt(r,10);if(i){if(process.platform==="win32"){await s(`taskkill /F /PID ${i}`);return}await s(`kill -9 ${i}`)}};var l=o;export{l as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.646",
4
+ "version": "0.0.0-canary.648",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -4,11 +4,16 @@ import util from 'util';
4
4
  const exec = util.promisify(child_process.exec);
5
5
 
6
6
  const kill_process_id = async (process_id = 0) => {
7
- if (process.platform === 'win32') {
8
- await exec(`taskkill /F /PID ${process_id}`);
9
- }
7
+ const process_id_as_integer = parseInt(process_id, 10);
8
+
9
+ if (process_id_as_integer) {
10
+ if (process.platform === 'win32') {
11
+ await exec(`taskkill /F /PID ${process_id_as_integer}`);
12
+ return;
13
+ }
10
14
 
11
- await exec(`kill -9 ${process_id}`);
15
+ await exec(`kill -9 ${process_id_as_integer}`);
16
+ }
12
17
  };
13
18
 
14
19
  export default kill_process_id;