Skip to content

Windows: ProcessBase.php line 172: Unable to decode output into JSON: Syntax error #56

Open
@Ambient-Impact

Description

@Ambient-Impact

Describe the bug or behavior
Running drush drupal:directory always results in an exception:

E:\Web\Ambient.Impact\Web (4.x -> origin) ([email protected])
λ drush drupal:directory ambientimpact_base

In ProcessBase.php line 172:

  Unable to decode output into JSON: Syntax error

  {
      "%paths": {
          "%root": "E:\Web\Ambient.Impact\Web/drupal",
          "%site": "sites/default",
          "%modules": "sites/all/modules",
          "%themes": "sites/all/themes",
          "%config-sync": "E:\Web\Ambient.Impact\Web/drupal/../drupal_config/sync",
          "%files": "sites/default/files",
          "%temp": "C:\Users\i\AppData\Local\Temp",
          "%private": "E:\Web\Ambient.Impact\Web/drupal/../drupal_private_files",
          "%ambientimpact_base": "E:\Web\Ambient.Impact\Web/drupal/themes/ambientimpact/ambientimpact_base"
      }
  }

To Reproduce
See above.

Expected behavior
Not a horrible error. :P

Actual behavior
See output above.

Workaround
After a bit of digging and trial and error, I discovered that commenting out line 162 in ProcessBase.php fixes the issue for some reason, i.e. this line:

$output = preg_replace('#\\\\{2}#', '\\', $output);

Then running the same Drush command completes successfully:

E:\Web\Ambient.Impact\Web (4.x -> origin) ([email protected])
λ drush drupal:directory ambientimpact_base
E:/Web/Ambient.Impact/Web/drupal/themes/ambientimpact/ambientimpact_base

System Configuration

Q A
Drush version? 10.6.1
Drupal version? 9.3.0
PHP version 7.3.15
OS? Windows 10 Pro, version 21H1, build 19043.1415

Additional information
Possible related, posted comment: drush-ops/drush#4281

Metadata

Metadata

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions