Skip to content

Windows: Command Failed at startup when the username contains ampersands #1395

@jviotti

Description

@jviotti

This happens as soon as you open the app:

Command failed: C:\Users\Foo & Bar\AppData\Local\Temp\9DB4.tmp.bat 'C:\Users\Foo' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. (code 1

This can be more easily reproduced by placing drivelist in a directory containing an ampersand and executing the example file:

git clone https://github.com/resin-io-modules/drivelist
move drivelist "Foo & Bar"
cd "Foo & Bar"
node example.js

This file is executed by child_process.execFile(). Simple tricks like quoting the whole path don't work. I also tried escaping the ampersand with ^&.

I did make it work by setting the execFile cwd option to the directory name of the script and then simply executing the basename, however that won't play well with asar archives. And to put another constraint to this: .execFile is the only spawning function we can use, since its the only one that is patched by Electron.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions