File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 2
2
"use strict" ;
3
3
4
4
import Future = require( "fibers/future" ) ;
5
+ import fs = require( "fs" ) ;
6
+ import path = require( "path" ) ;
5
7
import util = require( "util" ) ;
6
8
require ( "colors" ) ;
7
9
@@ -20,12 +22,16 @@ export class CommandExecutor implements ICommandExecutor {
20
22
private executeCore ( commandName : string , commandArguments : string [ ] ) : IFuture < void > {
21
23
return ( ( ) => {
22
24
try {
23
- var command : ICommand = new ( require ( "./commands/" + commandName ) . Command ) ( ) ;
24
- if ( ! command ) {
25
- errors . fail ( "Unable to resolve commandName %s" , commandName ) ;
25
+ let filePath = path . join ( __dirname , "commands" , commandName + ".js" ) ;
26
+ if ( fs . existsSync ( filePath ) ) {
27
+ var command : ICommand = new ( require ( filePath ) . Command ) ( ) ;
28
+ if ( ! command ) {
29
+ errors . fail ( "Unable to resolve commandName %s" , commandName ) ;
30
+ }
31
+
32
+ command . execute ( commandArguments ) . wait ( ) ;
26
33
}
27
34
28
- command . execute ( commandArguments ) . wait ( ) ;
29
35
} catch ( e ) {
30
36
if ( options . debug ) {
31
37
throw e ;
You can’t perform that action at this time.
0 commit comments