mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
20 lines
520 B
JavaScript
20 lines
520 B
JavaScript
'use strict';
|
|
|
|
const BbPromise = require('bluebird');
|
|
const childProcess = BbPromise.promisifyAll(require('child_process'));
|
|
|
|
function localEmulatorInstalled(localEmulatorVersion) {
|
|
try {
|
|
const cp = childProcess.spawnSync('sle', ['ping'], { encoding: 'utf8' });
|
|
const currentVersion = cp.stdout.trim();
|
|
if (currentVersion === 'pong' || (currentVersion !== localEmulatorVersion)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
module.exports = localEmulatorInstalled;
|