diff --git a/src/Context.ts b/src/Context.ts index ed7324b..e4e5abb 100644 --- a/src/Context.ts +++ b/src/Context.ts @@ -14,10 +14,10 @@ export class Context { this.stdout = process.stdout; this.stdin = process.stdin; this.stderr = process.stderr; - this.log = console.log; - this.error = console.error; - this.debug = Log.log().debug; - this.info = Log.log().info; + this.log = (msg: string) => console.log(msg); + this.error = (msg?: string, error?: any) => console.error(msg, error); + this.debug = (msg: string) => Log.log().debug(msg); + this.info = (msg: string) => Log.log().info(msg); this.exception = (exception: Error, level?: string) => Log.log().exception(level || Log.level.error, exception); } -} \ No newline at end of file +} diff --git a/src/app.ts b/src/app.ts index f0c8a55..faf4ded 100755 --- a/src/app.ts +++ b/src/app.ts @@ -161,7 +161,7 @@ export class App { private async loadConfig(loadFromFile: boolean): Promise { if (loadFromFile) return ConfigLoader.loadConfig(this.commander); - else return Promise.resolve({ ...StaticConfig.DEFAULT_CONFIG, configFilePath: process.cwd() }); + else return { ...StaticConfig.DEFAULT_CONFIG, configFilePath: process.cwd() }; } private runCb(doneCallback: (error: any, result?: string) => void) { @@ -184,7 +184,7 @@ export class App { this.commandExecutionBegun = true; (async () => { try { - this.initAction(); + await this.initAction(); const result: string = await action(); this.doneCallback(undefined, result); } catch (error) {