@@ -30,25 +30,25 @@ internal class ToolRunCommand(
30
30
private readonly ILocalToolsResolverCache _localToolsResolverCache = new LocalToolsResolverCache ( ) ;
31
31
public override int Execute ( )
32
32
{
33
- CommandSpec commandspec = _localToolsCommandResolver . ResolveStrict ( new CommandResolverArguments ( )
33
+ CommandSpec commandSpec = _localToolsCommandResolver . ResolveStrict ( new CommandResolverArguments ( )
34
34
{
35
35
// since LocalToolsCommandResolver is a resolver, and all resolver input have dotnet-
36
36
CommandName = $ "dotnet-{ _toolCommandName } ",
37
37
CommandArguments = _forwardArgument ,
38
38
39
39
} , _allowRollForward ) ;
40
40
41
- if ( commandspec == null && _fromSource )
41
+ if ( commandSpec == null && _fromSource && UserAgreedToExecuteFromSource ( ) )
42
42
{
43
43
return ExecuteFromSource ( ) ;
44
44
}
45
45
46
- if ( commandspec == null )
46
+ if ( commandSpec == null )
47
47
{
48
48
throw new GracefulException ( [ string . Format ( CliCommandStrings . CannotFindCommandName , _toolCommandName ) ] , isUserError : false ) ;
49
49
}
50
50
51
- var result = CommandFactoryUsingResolver . Create ( commandspec ) . Execute ( ) ;
51
+ var result = CommandFactoryUsingResolver . Create ( commandSpec ) . Execute ( ) ;
52
52
return result . ExitCode ;
53
53
}
54
54
@@ -91,4 +91,11 @@ public int ExecuteFromSource()
91
91
92
92
return result . ExitCode ;
93
93
}
94
+
95
+ private bool UserAgreedToExecuteFromSource ( )
96
+ {
97
+ // TODO: Use a better way to ask for user input
98
+ Console . WriteLine ( "Tool will be run from source. Accept? [yn]" )
99
+ return Console . ReadLine ( ) == 'y' ;
100
+ }
94
101
}
0 commit comments