tiro-notes 0.27.49 → 0.27.50
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/package.json +1 -1
- package/shared.helpers.build.js +11 -7
package/package.json
CHANGED
package/shared.helpers.build.js
CHANGED
|
@@ -44,6 +44,7 @@ const checkAndGetTiroConfig = (str, p) => {
|
|
|
44
44
|
const execCmd = (cmd, params, p) => {
|
|
45
45
|
if (!p) p = {}
|
|
46
46
|
if (!p.env) p.env = {}
|
|
47
|
+
if (!p.sync) p.sync = false
|
|
47
48
|
if (!p.platform) p.platform = false
|
|
48
49
|
p.logName = !p.logName ? '' : `${p.logName} `
|
|
49
50
|
const log = whichLog(p);
|
|
@@ -51,7 +52,7 @@ const execCmd = (cmd, params, p) => {
|
|
|
51
52
|
log(`[${p.logName}] === ExecCMD ${JSON.stringify({cmd, params, p})}`);
|
|
52
53
|
|
|
53
54
|
let child
|
|
54
|
-
let spawn = require( 'child_process' ).spawn;
|
|
55
|
+
let spawn = p.sync ? require( 'child_process' ).spawnSync : require( 'child_process' ).spawn;
|
|
55
56
|
child = spawn( cmd, params, {env: { ...process.env, ...p.env }});
|
|
56
57
|
|
|
57
58
|
// try {
|
|
@@ -65,7 +66,11 @@ const execCmd = (cmd, params, p) => {
|
|
|
65
66
|
console.log( str );
|
|
66
67
|
if (p && p.onLog) p.onLog(str)
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
child.on( 'close', data => {
|
|
70
|
+
const str = `[${p.logName} (${cmd}) ON CLOSE] : ${data}`;
|
|
71
|
+
console.log( str );
|
|
72
|
+
if (p && p.onClose) p.onClose(str)
|
|
73
|
+
});
|
|
69
74
|
return child;
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -78,13 +83,12 @@ const killPreviousInstances = (cb) => {
|
|
|
78
83
|
if (isWin) {
|
|
79
84
|
cb()
|
|
80
85
|
} else {
|
|
81
|
-
|
|
82
|
-
execCmd('sh', ['-c',
|
|
86
|
+
// execCmd('sh', ['-c', "ls"], {
|
|
87
|
+
execCmd('sh', ['-c', "ps -ef | grep \'tiro-server.js\' | grep -v grep | awk \'{print $2}\' | xargs -r kill -9"], {
|
|
88
|
+
// execCmd('sh', ['-c', "kill -9 $(ps aux | grep \'tiro-server.js\' | awk '{print $2}' )"], {
|
|
83
89
|
|
|
84
90
|
logName: 'Kill prev tiroServer',
|
|
85
|
-
|
|
86
|
-
if (!cb1) return
|
|
87
|
-
cb1 = false;
|
|
91
|
+
onClose: () => {
|
|
88
92
|
cb()
|
|
89
93
|
}
|
|
90
94
|
})
|