Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Commit 6b32bf5

Browse files
committed
fix(startup): delay loading some things to speed up startup
1 parent f2fa6b3 commit 6b32bf5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

get-prefix.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const BB = require('bluebird')
44

5-
const fs = BB.promisifyAll(require('fs'))
5+
const statAsync = BB.promisify(require('fs').stat)
66
const path = require('path')
77

88
module.exports = getPrefix
@@ -44,7 +44,7 @@ function getPrefix (current, root) {
4444
}
4545

4646
function fileExists (f) {
47-
return fs.statAsync(f).catch({code: 'ENOENT'}, () => false)
47+
return statAsync(f).catch({code: 'ENOENT'}, () => false)
4848
}
4949

5050
function isRootPath (p) {

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
const BB = require('bluebird')
55

6-
const autoFallback = require('./auto-fallback.js')
76
const child = require('./child')
87
const getPrefix = require('./get-prefix.js')
98
const parseArgs = require('./parse-args.js')
@@ -22,7 +21,9 @@ module.exports = main
2221
function main (argv) {
2322
const shell = argv['shell-auto-fallback']
2423
if (shell || shell === '') {
25-
const fallback = autoFallback(shell, process.env.SHELL, argv)
24+
const fallback = require('./auto-fallback.js')(
25+
shell, process.env.SHELL, argv
26+
)
2627
if (fallback) {
2728
console.log(fallback)
2829
process.exit(0)

0 commit comments

Comments
 (0)