Running the core-config command results in the following:

[ed@a4suited ~]$ drush --debug conf
Bootstrap to phase 0. [0.01 sec, 2.97 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.15 MB] [bootstrap]
Loading drushrc "/home/ed/.drush/drushrc.php" into "home.drush" scope. [0.01 sec, 3.15 MB]            [bootstrap]
Cache HIT cid: 6.0-dev-commandfiles-0-85c4cd9976427d939c1615b7e0830ae4 [0.02 sec, 3.17 MB]                [debug]
Bootstrap to phase 0. [0.07 sec, 6.84 MB]                                                             [bootstrap]
Found command: core-config (commandfile=core) [0.1 sec, 6.84 MB]                                      [bootstrap]
Enter a number to choose which file to edit.
 [0]  :  Cancel                                          
         -- PHP ini files --                             
 [1]  :  /etc/php5/cli/php.ini                           
         -- Drushrc --                                   
 [2]  :  /home/ed/.drush/drushrc.php                     

2
Executing: $EDITOR /home/ed/.drush/drushrc.php &
Calling proc_open($EDITOR /home/ed/.drush/drushrc.php &);
Received SIGHUP or SIGTERM
Logged command and option names to local cache. [1.63 sec, 6.9 MB]                                        [debug]
Command dispatch complete [1.63 sec, 6.89 MB]                                                            [notice]
Peak memory usage was 7.87 MB [1.63 sec, 6.89 MB]                                                        [memory]
[ed@a4suited ~]$ 
[ed@a4suited ~]$ drush --debug st
Bootstrap to phase 0. [0.01 sec, 2.97 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.15 MB] [bootstrap]
Loading drushrc "/home/ed/.drush/drushrc.php" into "home.drush" scope. [0.01 sec, 3.15 MB]            [bootstrap]
Cache HIT cid: 6.0-dev-commandfiles-0-85c4cd9976427d939c1615b7e0830ae4 [0.02 sec, 3.17 MB]                [debug]
Bootstrap to phase 0. [0.07 sec, 6.84 MB]                                                             [bootstrap]
Found command: core-status (commandfile=core) [0.1 sec, 6.84 MB]                                      [bootstrap]
 PHP configuration     :  /etc/php5/cli/php.ini                                                               
 Drush version         :  6.0-dev                                                                             
 Drush configuration   :  /home/ed/.drush/drushrc.php                                                         
 Drush alias files     :  
Logged command and option names to local cache. [0.19 sec, 6.86 MB]                                       [debug]
Command dispatch complete [0.19 sec, 6.85 MB]                                                            [notice]
Peak memory usage was 7.81 MB [0.2 sec, 6.85 MB]                                                         [memory]
[ed@a4suited ~]$ 

Is this a bug, or misconfiguration on my end? Thanks

CommentFileSizeAuthor
#3 config-bg.patch1.9 KBgreg.1.anderson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezeedub’s picture

ezeedub’s picture

I'm still getting this error. The above is if $EDITOR = nano. For $EDITOR = vi, I get:

Executing: $EDITOR /home/ed/.drush/drushrc.php &
Calling proc_open($EDITOR /home/ed/.drush/drushrc.php &);

Vim: Warning: Input is not from a terminal
Command dispatch complete       
Vim: Error reading input, exiting...

The error makes the command completely useless, and I want to use it! Any insight greatly appreciated.

greg.1.anderson’s picture

Status: Active » Needs review
FileSize
1.9 KB

The problem with drush config is that by convention, $EDITOR is supposed to launch an editor and wait for it to exit, whereas Drush would like control returned to the terminal as soon as the editor window opens. To get its "desired" behavior, Drush adds an & to the end of the input, so that the editor will run in the background. This kills editors such as vim, which expect to run in the terminal, and therefore cannot run in the background.

There is no good way for Drush to know if $EDITOR points to an editor that is going to run in the terminal, or in an X window. Perhaps the best thing to do would be to parameterize the &, so that the user may specify whether or not it should run in the background. You could always set $options['bg'] = TRUE if you'd like to maintain the current behavior.

Patch implementing the proposed behavior attached.

moshe weitzman’s picture

At first glance, this changes current behavior. Is this deliberate? OK for drush5? Also, I think we do the $EDITOR thing elsewhere in drush?

greg.1.anderson’s picture

While this does change current behavior, I do not expect the 'core-config' command to be called from external scripts, so I think it's okay. To strictly keep existing behavior, we could use drush_get_option('bg', TRUE) until Drush 6, and have folks use --bg=0 to make vi work. I prefer it as rolled in #3, but could go with the switch if desired.

A global search of Drush revealed no other use of EDITOR, and I can't think of other places we might also do this.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed. I was recalling $EDITOR from early versions of #1005480: Create a new project to develop Drush entity support

ezeedub’s picture

Great, thanks gentlemen! Just out of curiosity, to which branch would this be committed? Or is there a delay b/w the commit and my seeing it?

I see...


[ed@a4suited drush (master * u=)]$ git branch -a
  1489972-cmi
  5.x-1.x
  7.x-1.x
  7.x-4.x
  github
* master
  upstream
  remotes/origin/1489972-cmi
  remotes/origin/4.7.x-1.x
  remotes/origin/5.x-1.x
  remotes/origin/6.x-1.x
  remotes/origin/6.x-3.x
  remotes/origin/7.x-1.x
  remotes/origin/7.x-4.x
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev-secure-creds
  remotes/origin/github
  remotes/origin/htmlhelp
  remotes/origin/master
  remotes/origin/upstream

I tried checking out the few you see, but didn't see the commit. (So I just applied the patch to master.)

greg.1.anderson’s picture

Assigned: Unassigned » moshe weitzman
Status: Fixed » Needs review

@moshe: I think you need to push the commit.

greg.1.anderson’s picture

Status: Needs review » Fixed

Re-applied the patch and pushed the commit.

ezeedub’s picture

Status: Fixed » Closed (fixed)

Thanks, got it.