diff options
| author | otofune <otofune@gmail.com> | 2017-01-25 20:38:19 +0900 |
|---|---|---|
| committer | otofune <otofune@gmail.com> | 2017-01-25 22:31:22 +0900 |
| commit | f462c00090dd6998e2940639799f49895245448c (patch) | |
| tree | ad00f743202e44b8ebc481c51be9a7f3b83165fb /src/utils/dependencyInfo.ts | |
| parent | Merge pull request #74 from armchair-philosophy/dc_mongo (diff) | |
| download | misskey-f462c00090dd6998e2940639799f49895245448c.tar.gz misskey-f462c00090dd6998e2940639799f49895245448c.tar.bz2 misskey-f462c00090dd6998e2940639799f49895245448c.zip | |
[utils] dependencyInfo: use child_process instead of shelljs
drop shelljs from dependencies.
Diffstat (limited to 'src/utils/dependencyInfo.ts')
| -rw-r--r-- | src/utils/dependencyInfo.ts | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/utils/dependencyInfo.ts b/src/utils/dependencyInfo.ts index 9d2c6a1d4f..c7c1441ec1 100644 --- a/src/utils/dependencyInfo.ts +++ b/src/utils/dependencyInfo.ts @@ -1,5 +1,5 @@ import Logger from './logger'; -import { exec } from 'shelljs'; +import { execSync } from 'child_process'; export default class { logger: Logger; @@ -15,20 +15,16 @@ export default class { } show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void { - const code = { - success: 0, - notFound: 127 - }; - const x = exec(command, { silent: true }) as any; - if (x.code === code.success) { - let ver = transform(x.stdout); + try { + const x = execSync(command, { stdio: ['pipe', 'pipe', 'ignore'] }); + const ver = transform(x.toString()); if (ver != null) { this.logger.info(`${serviceName} ${ver[1]} found`); } else { this.logger.warn(`${serviceName} not found`); this.logger.warn(`Regexp used for version check of ${serviceName} is probably messed up`); } - } else if (x.code === code.notFound) { + } catch (e) { this.logger.warn(`${serviceName} not found`); } } |