docs: Add notes on spawn and exec
This commit is contained in:
parent
6fb944c842
commit
a1fdc701ee
1 changed files with 12 additions and 0 deletions
|
@ -132,6 +132,7 @@ work. This adds a little overhead for those APIs.
|
||||||
APIs that requires extra unpacking are:
|
APIs that requires extra unpacking are:
|
||||||
|
|
||||||
* `child_process.execFile`
|
* `child_process.execFile`
|
||||||
|
* `child_process.execFileSync`
|
||||||
* `fs.open`
|
* `fs.open`
|
||||||
* `fs.openSync`
|
* `fs.openSync`
|
||||||
* `process.dlopen` - Used by `require` on native modules
|
* `process.dlopen` - Used by `require` on native modules
|
||||||
|
@ -143,6 +144,17 @@ archives is generated by guessing, because those files do not exist on the
|
||||||
filesystem. So you should not trust the `Stats` object except for getting file
|
filesystem. So you should not trust the `Stats` object except for getting file
|
||||||
size and checking file type.
|
size and checking file type.
|
||||||
|
|
||||||
|
### Executing Binaries Inside `asar` Archive
|
||||||
|
|
||||||
|
There are Node APIs that can execute binaries like `child_process.exec`,
|
||||||
|
`child_process.spawn` and `child_process.execFile`, but only `execFile` is
|
||||||
|
supported to execute binaries inside `asar` archive.
|
||||||
|
|
||||||
|
This is because `exec` and `spawn` accept `command` instead of `file` as input,
|
||||||
|
and `command`s are executed under shell. There is no reliable way to determine
|
||||||
|
whether a command uses a file in asar archive, and even if we do, we can not be
|
||||||
|
sure whether we can replace the path in command without side effects.
|
||||||
|
|
||||||
## Adding Unpacked Files in `asar` Archive
|
## Adding Unpacked Files in `asar` Archive
|
||||||
|
|
||||||
As stated above, some Node APIs will unpack the file to filesystem when
|
As stated above, some Node APIs will unpack the file to filesystem when
|
||||||
|
|
Loading…
Reference in a new issue