electron/lib/common
Juan Cruz Viotti 1a27ecdad4 Override child_process.execFile asar patch for child_process.exec
NodeJS implements `child_process.exec` by simply passing the whole
command to `child_process.execFile`. See:

- https://github.com/nodejs/node/blob/master/lib/child_process.js#L90
- https://github.com/nodejs/node/blob/master/lib/child_process.js#L99

Electron patches `child_process.execFile` to add support for `asar`
archives by injecting logic that extracts the required files from the
`asar` to a temporary location before delegating the work to the
original `child_process.execFile`.

In order to decide whether to inject the custom `asar` extracting logic,
Electron makes use of a helper function called `splitPath()`. See:

- https://github.com/electron/electron/blob/master/lib/common/asar.js#L37

If the first argument of the returned array equals `true`, means that
the path is considered to be an `asar` archive, and thus the extraction
logic takes place. The problem is that if the command passed to
`child_process.execFile` *contains* a path to an asar archive, padded
with other commands/arguments, `splitPath()` will consider it to be an
`asar` archive, and will try to extract it, throwing a rightfully
`Invalid package` error.

Fixes: https://github.com/electron/electron/issues/5571
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-19 17:19:36 -04:00
..
api Remove linter errors 2016-05-06 10:12:55 -07:00
asar.js Override child_process.execFile asar patch for child_process.exec 2016-05-19 17:19:36 -04:00
asar_init.js Rename ATOM_SHELL_ASAR to ELECTRON_ASAR 2016-04-08 08:53:58 -07:00
init.js Remove linter errors 2016-05-06 10:12:55 -07:00
reset-search-paths.js autoformat more easy files 2016-03-30 17:00:31 -07:00