@joystick.js/cli-canary 0.0.0-canary.645 → 0.0.0-canary.647

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"os";const e=(r="")=>t.platform()==="win32"?r.replace("/","\\"):r;var a=e;export{a as default};
1
+ import t from"os";const e=(r="")=>t.platform()==="win32"?r.replace(/\//g,"\\"):r;var a=e;export{a as default};
@@ -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 l from"child_process";import o from"util";const t=o.promisify(l.exec),r=async(i=0)=>{if(i){if(process.platform==="win32"){await t(`taskkill /F /PID ${i}`);return}await t(`kill -9 ${i}`)}};var c=r;export{c 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.645",
4
+ "version": "0.0.0-canary.647",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -2,7 +2,7 @@ import os from 'os';
2
2
 
3
3
  const get_platform_safe_path = (path = '') => {
4
4
  // NOTE: This is why serial killers exist.
5
- return os.platform() === "win32" ? path.replace('/', '\\') : path;
5
+ return os.platform() === "win32" ? path.replace(/\//g, '\\') : path;
6
6
  };
7
7
 
8
8
  export default get_platform_safe_path;
@@ -4,11 +4,14 @@ 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
+ if (process_id) {
8
+ if (process.platform === 'win32') {
9
+ await exec(`taskkill /F /PID ${process_id}`);
10
+ return;
11
+ }
10
12
 
11
- await exec(`kill -9 ${process_id}`);
13
+ await exec(`kill -9 ${process_id}`);
14
+ }
12
15
  };
13
16
 
14
17
  export default kill_process_id;