提交 b690c19b 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

statSync doc

上级 6a400a27
...@@ -98,7 +98,7 @@ function isWechatyDocker() { ...@@ -98,7 +98,7 @@ function isWechatyDocker() {
} }
const cgroup = '/proc/1/cgroup' const cgroup = '/proc/1/cgroup'
try { fs.statSync(cgroup) } try { fs.statSync(cgroup) // .isFile() }
catch (e) { return false } catch (e) { return false }
const line = execSync(`sort -n ${cgroup} | head -1`) const line = execSync(`sort -n ${cgroup} | head -1`)
......
...@@ -99,7 +99,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -99,7 +99,7 @@ export class Wechaty extends EventEmitter implements Sayable {
public toString() { return 'Class Wechaty(' + this.setting.type + ')'} public toString() { return 'Class Wechaty(' + this.setting.type + ')'}
public version(forceNpm = false) { public version(forceNpm = false) {
const dotGitPath = path.join(__dirname, '..', '.git') const dotGitPath = path.join(__dirname, '..', '.git') // `/src/../.git`
const gitLogCmd = 'git' const gitLogCmd = 'git'
const gitLogArgs = ['log', '--oneline', '-1'] const gitLogArgs = ['log', '--oneline', '-1']
...@@ -110,7 +110,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -110,7 +110,7 @@ export class Wechaty extends EventEmitter implements Sayable {
* This throws if any accessibility checks fail, and does nothing otherwise. * This throws if any accessibility checks fail, and does nothing otherwise.
*/ */
// fs.accessSync(dotGitPath, fs.F_OK) // fs.accessSync(dotGitPath, fs.F_OK)
fs.statSync(dotGitPath) fs.statSync(dotGitPath) // .isDirectory()
const ss = require('child_process') const ss = require('child_process')
.spawnSync(gitLogCmd, gitLogArgs, { cwd: __dirname }) .spawnSync(gitLogCmd, gitLogArgs, { cwd: __dirname })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册