@joystick.js/cli-canary 0.0.0-canary.641 → 0.0.0-canary.642

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,2 +1,2 @@
1
- import r from"child_process";import n from"util";const o=n.promisify(r.exec),p=async(e=0)=>{if(process.platform==="win32"){const s=(await o(`\\windows\\system32\\netstat.exe -a -n -o | findstr.exe :${e}`)).stdout?.split(`
2
- `);return(s&&s[0]&&s[0]?.split(" ")?.filter(t=>t!=="")?.map(t=>t?.replace("\r",""))?.pop())?.stdout||null}return(await o(`lsof -n -i:${e} | grep LISTEN | awk '{ print $2 }' | uniq`))?.stdout||null};var d=p;export{d as default};
1
+ import o from"child_process";import n from"util";const r=n.promisify(o.exec),p=async(e=0)=>{if(process.platform==="win32"){const s=(await r(`netstat -a -n -o | find "${e}"`)).stdout?.split(`
2
+ `);return s&&s[0]&&s[0]?.split(" ")?.filter(t=>t!=="")?.map(t=>t?.replace("\r",""))?.pop()||null}return(await r(`lsof -n -i:${e} | grep LISTEN | awk '{ print $2 }' | uniq`))?.stdout||null};var u=p;export{u 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.641",
4
+ "version": "0.0.0-canary.642",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -5,13 +5,13 @@ const exec = util.promisify(child_process.exec);
5
5
 
6
6
  const get_process_id_from_port = async (port = 0) => {
7
7
  if (process.platform === 'win32') {
8
- const stat = await exec(`\\windows\\system32\\netstat.exe -a -n -o | findstr.exe :${port}`);
8
+ const stat = await exec(`netstat -a -n -o | find "${port}"`);
9
9
  const stat_result = stat.stdout?.split('\n');
10
10
  const process_id_response = stat_result && stat_result[0] && stat_result[0]?.split(' ')?.filter((value) => value !== '')?.map((value) => {
11
11
  return value?.replace('\r', '');
12
12
  })?.pop();
13
13
 
14
- return process_id_response?.stdout || null;
14
+ return process_id_response || null;
15
15
  }
16
16
 
17
17
  const process_id_response = await exec(`lsof -n -i:${port} | grep LISTEN | awk '{ print $2 }' | uniq`);