@@ -365,8 +365,8 @@ def dispatch(command)
365
365
# Run a command with a procodile environment
366
366
#
367
367
desc "Execute a command within the environment"
368
- command def exec
369
- desired_command = ARGV . drop ( 1 ) . join ( ' ' )
368
+ command def exec ( command = nil )
369
+ desired_command = command || ARGV . drop ( 1 ) . join ( ' ' )
370
370
371
371
if prefix = @config . exec_prefix
372
372
desired_command = "#{ prefix } #{ desired_command } "
@@ -375,8 +375,14 @@ def dispatch(command)
375
375
if desired_command . length == 0
376
376
raise Error , "You need to specify a command to run (e.g. procodile run -- rake db:migrate)"
377
377
else
378
+ environment = @config . environment_variables
379
+ puts "Running with #{ desired_command . color ( 33 ) } "
380
+ for key , value in environment
381
+ puts " #{ key . color ( 34 ) } #{ value } "
382
+ end
383
+
378
384
begin
379
- Kernel . exec ( @config . environment_variables , desired_command )
385
+ Kernel . exec ( environment , desired_command )
380
386
rescue Errno ::ENOENT => e
381
387
raise Error , e . message
382
388
end
@@ -391,16 +397,7 @@ def dispatch(command)
391
397
desc "Open a console within the environment"
392
398
command def console
393
399
if cmd = @config . console_command
394
- environment = @config . environment_variables
395
- puts "Starting with #{ cmd . color ( 33 ) } "
396
- for key , value in environment
397
- puts " #{ key . color ( 34 ) } #{ value } "
398
- end
399
- begin
400
- exec ( environment , cmd )
401
- rescue Errno ::ENOENT => e
402
- raise Error , e . message
403
- end
400
+ exec ( cmd )
404
401
else
405
402
raise Error , "No console command has been configured in the Procfile"
406
403
end
0 commit comments