File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -439,7 +439,7 @@ def start(given_args = ARGV, config = {})
439
439
config [ :shell ] ||= Thor ::Base . shell . new
440
440
dispatch ( nil , given_args . dup , nil , config )
441
441
rescue Thor ::Error => e
442
- ENV [ 'THOR_DEBUG' ] == '1' ? ( raise e ) : config [ :shell ] . error ( e . message )
442
+ config [ :debug ] || ENV [ 'THOR_DEBUG' ] == '1' ? ( raise e ) : config [ :shell ] . error ( e . message )
443
443
exit ( 1 ) if exit_on_failure?
444
444
rescue Errno ::EPIPE
445
445
# This happens if a thor command is piped to something like `head`,
Original file line number Diff line number Diff line change @@ -256,6 +256,12 @@ def hello
256
256
end
257
257
end
258
258
259
+ it 'raises an error instead of rescuing if :debug option is given' do
260
+ expect do
261
+ MyScript . start %w[ what ] , :debug => true
262
+ end . to raise_error ( Thor ::UndefinedCommandError , 'Could not find command "what" in "my_script" namespace.' )
263
+ end
264
+
259
265
it 'does not steal args' do
260
266
args = %w[ foo bar --force true ]
261
267
MyScript . start ( args )
You can’t perform that action at this time.
0 commit comments