Solveddrush Remote drush commands not exporting to file using >

Describe the bug
After upgrading from drush 9.5.2 to drush 9.6.0 the drush sql-dump command does not dump the output to a file, running the command from the

To Reproduce
What did you do?

drush @remote.stg sql:dump > tmp/db.sql

Expected behavior
The file tmp/db.sql should have all the database dumped.

Actual behavior
The file tmp/db.sql is empty.

Workaround
Is there another way to do the desired action?
Make the action in two steps:

drush @remote.stg sql-dump --target-file=<targetfile>
drush rsync @remote.stg:<targetfile> tmp/db.sql

System Configuration

Q A
Drush version? 9.6.0
Drupal version? 8.6.12
PHP version 7.1.17-
OS? Ubuntu 17.10

Remote environment os:
Linux **** 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64 GNU/Linux

Drush alias

stg:
  uri: 'host.domain'
  root: '/path/to/codebase'
  host: 'host.domain'
  user: 'remote-user'
  command:
    sql:
      sync:
        options:
          structure-tables-list: 'cache*,session,watchdog'
    dump:
      sync:
        options:
          structure-tables-list: 'cache*,session,watchdog'
16 Answers

✔️Accepted Answer

For anyone coming across this issue. I had a similar problem with Drush 9.7.0 where sql:dump output was sent to standard output instead of a file. Based on the above workaround, I fixed it with the 'ssh' option in the drush alias of the remote site:

remote:
  ssh:
    tty: 0

Other Answers:

I had the same problem and the comment above (#4004 (comment)) helped me. But it was not immediately obvious that remote is not a configuration option but the name of your alias. I was about to give up thinking it was an option in an older version of Drush. In case it helps someone.

stage:
  host: ...
  user: ...
  root: ...
  uri: ...
  ssh:
    tty: 0

The problem is that Drush is setting tty mode even though output is redirected. This is wrong.

Workaround:

drush -Dssh.tty=0 @cd version 2> tmp/version.txt

Should have a fix shortly.

Related Issues:

37
drush drush 8.0.3 installation failure: symfony/yaml conflict
Thanks for the tip I was able to solve this by removing drush with composer then reinstalling Here's...
13
drush Remote drush commands not exporting to file using >
For anyone coming across this issue I had a similar problem with Drush 9.7.0 where sql:dump output w...
548
svgo no such file or directory .svgo.yml
I noticed this problem with Yarn after someone had run yarn clean Deleting the .yarnclean file delet...
294
ohmyzsh compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew
Per #9602 (comment) brew cleanup fixed it for me I am using Apple M1 When I added this line: export ...
286
angular cli Issue: Cannot read property 'thisCompilation' of undefined
Here is the answer from issues #9793 : npm remove webpack npm install webpack@3.11.0 ...
269
sdk dotnet build error - the project 'Web' must provide a value for Configuration
I had this infuriating issue when migrating a .NET Core 2.2 app to core 3.0 Steps to reproduce I run...
266
ionic cli cordova build android error spawn EACCES when I update Android Studio 3.0(Gradle 4.1)
After a long and really frustrating night I got mine woking Description: cordova build android ANDRO...
264
tqdm Jupyterlab and tqdm_notebook
I confirm this problem on my environment but it is upstream so IMHO nothing can be done on tqdm Plea...
255
angular cli Error | Could not find plugin "proposal-numeric-separator" | Generating ES5 bundles for differential loading
Try to install @babel/compat-data: ~7.8.0 to devDependencies This is the only workaround which helpe...
236
angular cli Using invalid environment causes error in build (was "ERROR in Cannot read property 'length' of undefined")
Probably not the same cause but we had the same error (Cannot read property 'length' of undefined) w...
232
angular cli ng serve method ip not open in another machines
The solution is simple Just bind to the correct interface address via ng serve --host=0.0.0.0 ...
226
angular cli Incorrect JS paths when ng build -prod is deployed in a subfolder
When you're deploying to non-root path within a domain you'll need to manually update the <base href...
222
nativescript cli TNS doctor doesn't recognize Xcode (High Sierra)
HI @philipfeldmann Can yhou please run xcodebuild -version and paste the output? May be Xcode is ins...
218
angular cli Installation error: permission denied for node-sas
sudo npm install -g --unsafe-perm --verbose @angular/cli Installation error (node-sass) with: node v...
208
angular cli ng build -prod Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'
Instead of use ng build --prod use ng build --env=prod UPDATE As many of us (thx) have mention this ...
207
psysh Not working after upgrading to PHP 7.3
May I know how do you open this file and drop in the code you mentioned? Thanks ...
184
expo cli Expo fails to start the project: error Invalid regular expression: /(.*\\__fixtures__
Got this issue today on windows but don't need to downgrade node Description I just initialize a new...
173
angular cli Property 'controls' does not exist on type 'AbstractControl'.
Got it! Looked at the docs - FormArray The FormArray class contains the controls property ...
167
angular cli [Bug] cli needs to be reloaded when a lazy loaded module is added in routes (FIXED)
I recomended change { path: 'user-panel' loadChildren: './user-panel/user-panel.module#UserPanelModu...
162
angular cli AOT build fails
I noticed same problem and after npm i enhanced-resolve@3.3.0 I can build with AOT ...
161
angular cli Cannot find name 'require'. using relative paths...
Ahhh here we go try adding declare var require: any; To src/typings.d.ts I am using a config with re...
152
expo cli XDLError: ValidationError: "scheme" is not allowed
can you try removing the .expo directory? rm -rf .expo in your project Description I'm having this e...
147
ionic cli Error: Cannot find module '@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/utils'
Try npm i @ionic/angular-toolkit@latest This worked in my project. Description: I was trying to star...
146
angular cli "No NgModule metadata found for 'AppModule'" after Upgrade to Angular 5.1.0 and AngularCli 1.6.0
I got the same error The issue is fixed only when i manually re installed angular/cli The webpack sh...
145
cli pod install failure with glog
what helped me: sudo xcode-select --switch /Applications/Xcode.app Ask your Question I have been try...
141
angular cli ng serve doesn't listen other than localhost
Works with command ng serve --host 0.0.0.0 OS? Windows 7 8 or 10 Linux (which distribution) Mac OSX ...
140
streamlink urllib3 (1.25.1) or chardet (3.0.4) doesn't match a supported version
Hello there I received this warning on Elementary OS 0.4.1 (based on Ubuntu 16.04.2) after installin...
136
terragrunt Upgrading to Terraform 0.12: separate configuration file for Terragrunt?
Hi all Hi! I'm one of the engineers at HashiCorp who works on Terraform Core As you might be aware ...
126
expo cli Could not load expo Network response timed out
The Network response timed out error means your phone can not connect to the Expo CLI running on you...
125
angular cli ng: command not found
Removing NODE and using NVM instead fixed a lot of issues After installing angular-cli with the help...
125
angular cli ng build fails with error Cannot find module 'webpack/lib/node/NodeTemplatePlugin' after updating to v1.3.0
I faced this issue many times recently and always the fix worked for me is : Bug Report or Feature R...
124
angular cli -bash: ng: command not found
This was a pain to figure out Please provide us with the following information: OS? Mac OSX (Seirra)...
124
angular cli Uncaught TypeError: Cannot read property 'apply' of undefined on new install
Downgraded to zone.js@0.8.5 and the problem disappeared. Bug Report or Feature Request (mark with an...
122
angular cli I am on Angular 5 and CLI 1.5 and I get an error
I faced this error after updating a non-CLI project to Angular 5 and @ngtools/webpack 1.8.0 ...
122
amplify cli Many-To-Many
You can implement many to many yourself using two 1-M @connections and a joining @model ...
120
cli How to skip one stage from multi-stage docker build
Docker 18.06 has been released Description We have Multistage docker build that creates rpm in each ...
114
angular cli Error in multi styles
Paths in angular-cli.json are relative to the project root (src/ normally) For instance you have the...
107
ripgrep Add support for replace in files
This is more easily accomplished using sed than I think people realize sed is quite a beast and is n...
107
angular cli Error loading npm linked custom library with aot
It seems like this is a issue caused by Typescript and not by Angular CLI Typescript has problems re...
106
sdk dotnet new console, publish, makes a dll not an exe
Can we reduce the confusion somehow? I work on .NET Core and I was confused <OutputType>Exe</OutputT...
106
expo cli expo build fails inside xdl with "Cannot read property 'forEach' of undefined"
Try changing assetBundlePatterns: [**/*] to assetBundlePatterns: [assets/*] in app.json ...
102
nest cli Error: Cannot find module '@nestjs/schematics/package.json'
try yarn global add @nestjs/schematics I'm submitting a.. Current behavior I already global add nest...
99
ohmyzsh how to enable username and hostname in the default theme?
In fact I finally found the solution for the problem I do want to stick with the default theme but I...
97
angular cli Cannot find module '@angular/compiler-cli' when running ng serve
Remove angular-cli from your package.json and replace it with @angular/cli $ npm uninstall angular-c...
94
ionic cli Ionic build android, Error: spawn EACCES
@alexharvey assuming you're on mac (or linux): What version of the CLI are you using? Output of ioni...
93
angular cli patterns.map is not a function
I have same issue Finally It looks like caused by a scheme changing The item assets now is an array ...
92
angular cli ng test ends with "Executed 0 of 0 ERROR"
#2125 see @jtsom 's answer: In the karma.conf.js file add: mime: { 'text/x-typescript': ['ts','tsx']...
91
angular cli Error while installing @angular/cli on AWS Ubuntu 16.04 server
This seems to be a problem with installing https://github.com/sass/node-sass which is one of the dep...
89
angular cli Existing App does not get Service Worker capabilities
I also had this issue the culprit seams to be angularFire2 I worked around it by registering the ser...