Skip to content
Extraits de code Groupes Projets
Vérifiée Valider bb96bff1 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

First 'attach' mode, works fine

parent 90508d16
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!11Work done on the instance side of Amadeus
......@@ -13,17 +13,53 @@ var client; /* Sub process for the express server */
class Lektor {
constructor() {
this.closed = false;
this.process = spawn('lektord', ['-F']);
this.closed = true;
this.process.stderr.on('data', data => {
logger.lektord(data);
this.isRunning('lektord.exe', 'lektord', 'lektord').then(v => {
if (v && config.attachmode) {
logger.info('main', `Lektord is running! Attach to it`);
} else if (v) {
logger.error('error', `Lektord is running and attach mode is disable, exit!`);
app.quit();
} else {
logger.debug('main', `Lektord not running, start it!`);
this.closed = false;
this.process = spawn('lektord', ['-F']);
this.process.stderr.on('data', data => {
logger.lektord(data);
});
this.process.on('close', code => {
logger.warn('main', `Lektor exited with code ${code}`);
this.lektor_closed = true;
app.quit();
});
}
});
}
this.process.on('close', code => {
logger.warn('main', `Lektor exited with code ${code}`);
this.lektor_closed = true;
app.quit();
isRunning(win, mac, linux) {
return new Promise(function (resolve, reject) {
//var ps = require('ps-node');
const exec = require('child_process').exec;
const plat = process.platform;
const cmd =
plat == 'win32'
? 'tasklist'
: plat == 'darwin'
? 'ps -ax | grep ' + mac
: plat == 'linux'
? 'ps -A'
: '';
const proc = plat == 'win32' ? win : plat == 'darwin' ? mac : plat == 'linux' ? linux : '';
if (cmd === '' || proc === '') {
resolve(false);
}
exec(cmd, function (err, stdout, stderr) {
resolve(stdout.toLowerCase().indexOf(proc.toLowerCase()) > -1);
});
});
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter