tiro-notes 0.27.23 → 0.27.24

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/cli.js CHANGED
@@ -42,6 +42,7 @@ function startTiroServer (argsObj, cb) {
42
42
  // start tiro server, detect success message and get server params
43
43
  tHelpers.execCmd('node', [`${__dirname}/server/server.js`], {
44
44
  env: { TIRO_PORT: argsObj.port },
45
+ logName: 'tiroServer',
45
46
  onLog: str => {
46
47
  tHelpers.checkAndGetTiroConfig(str, {platform: 'cli', cb})
47
48
  }
@@ -51,18 +52,28 @@ function startTiroServer (argsObj, cb) {
51
52
  const startSshTunnel = (argsObj) => {
52
53
  if (argsObj.tunnel.enabled) {
53
54
  // kill previous autossh processes
54
- tHelpers.execCmd('killall', [`autossh`], {logName:'tunnel'})
55
-
56
- // check if autossh is working
57
- try {
58
- tHelpers.execCmd('autossh', [`--help`], {logName:'tunnel'})
59
- } catch (e) {
60
- throw Error('autossh not installed on the system, please install it.')
55
+ let cb1 = true
56
+ let cb2 = true
57
+ tHelpers.execCmd('killall', [`autossh`], {
58
+ logName:'tunnel 1'
59
+ onLog: str => {
60
+ if (!cb1) return
61
+ cb1 = false
62
+
63
+ tHelpers.execCmd('autossh', [`--help`], {
64
+ logName:'tunnel 2'
65
+ onLog: str => {
66
+ if (!cb2) return
67
+ cb2 = false
68
+ tHelpers.execCmd('autossh',['-M','20000','-N', argsObj.tunnel.remoteUrl,'-R', `${argsObj.tunnel.remotePort}:localhost:${argsObj.port}`,'-C'], {logName:'tunnel 3'})
69
+ }
70
+ })
71
+
72
+ }
61
73
  }
74
+ })
62
75
 
63
- // check if autossh enabled
64
- tHelpers.execCmd('autossh', ['-M','20000','-f','-N',argsObj.tunnel.remoteUrl,`-R ${argsObj.tunnel.remotePort}:localhost:${argsObj.port}`,'-C'], {logName:'tunnel'})
65
- }
76
+ // check if autossh is working
66
77
 
67
78
  }
68
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiro-notes",
3
- "version": "0.27.23",
3
+ "version": "0.27.24",
4
4
  "description": "Tiro Notes for CLI",
5
5
  "scripts": {
6
6
  "clean-previous-build": "rm -r node-build",
@@ -56,7 +56,7 @@ const execCmd = (cmd, params, p) => {
56
56
 
57
57
  // try {
58
58
  child.stdout.on( 'data', data => {
59
- const str = `[${p.logName} ${cmd}] : ${data}`;
59
+ const str = `[${p.logName}${cmd}] : ${data}`;
60
60
  console.log( str );
61
61
  if (p && p.onLog) p.onLog(str)
62
62
  });