Commit graph

38 commits

Author SHA1 Message Date
Alex Greenland
dc93d94bc8 fix: support async child process methods without callback in asar (#15927)
* fix: support async child process methods without callback in asar

* fix: support async child process methods without callback in asar (improved)
2018-12-18 16:27:39 +09:00
Jeremy Apthorp
90d1c0b2b6
chore: don't explicitly destroy asar archives (#15734) 2018-11-19 13:12:41 -08:00
Shelley Vohr
40874ddec6
fix: update fs methods for options param (#15323)
* fix: update fs methods for options param

* fix: update rest of fs methods with changes
2018-10-23 15:14:05 -07:00
Felix Rieseberg
d1b2d1a10e fix: Remove statSyncNoException for good (#15092)
* fix: Small JS assignment error

* fix: Call the right og method

* fix: Goodbye, statSyncNoException
2018-10-12 19:43:19 +11:00
Cheng Zhao
4c4d8c5bfa fix: support ASAR in fs.copyFile (#14942) 2018-10-03 09:36:20 -07:00
Samuel Attard
176a76217c
chore: have 'use strict' consistently across our lib files (#14721) 2018-09-23 00:28:50 +12:00
Samuel Attard
558fff69e7
chore: update to standard 12 2018-09-14 14:57:01 +10:00
Alexey Kuzmin
382afc03ae chore: clean up asar stuff (#14505)
* chore: reformat code

* refactor: getOrCreateArchive() for ASARs

 - store cached archive in a Map
 - return `null` instead of `false` on failures

* refactor: splitPath() for ASARs

 - store custom extension in a constant
 - remove magic numbers
 - add comments

* refactor: explicitly use assert() for a developer error

* chore: remove console.log() calls

* refactor: replace "p" arguments with "pathArgument"

"path" would be a better name, but it is already taken
but the "path" Node module.

* refactor: createError() for ASARs

 - return an `Error` instance
 - use enum for error types
 - minor improvements

* refactor: use more meaningful name for an arg than just "arg"
2018-09-10 08:29:19 -07:00
Shelley Vohr
2963e377ae
refactor: clean up asar functionality (#14046) 2018-09-07 19:23:47 -07:00
Shelley Vohr
b785f45852
fix: override fs.realpathSync.native and fs.realpath.native (#14031)
* fix: override fs.realpathSync.native and fs.realpath.native
* spec: test new native functions
2018-08-12 00:10:55 -07:00
Shelley Vohr
8dae1c8447
fix: make asarStatsToFsStats nherit from fs.stats (#14030) 2018-08-11 23:20:33 -07:00
Milan Burda
c52b3d921e fix: some APIs modified for ASAR support cannot be util.promisify'ed (#13845) 2018-08-01 13:06:48 +10:00
Jack Teng
10df019075 fix: can't load module error when app is packaged
due to change in node.js(https://github.com/nodejs/node/issues/17076)
internalModuleReadFile has been renamed to internalModuleReadJSON, and
in vendor/node/lib/internal/modules/cjs/loader.js it will call
internalModuleReadJSON and result in can't read the package.json file.
2018-06-19 10:42:21 -07:00
Felix Rieseberg
f7d6e3fa7b 🔧 Disable standard/no-callback-literal where necessary 2017-11-23 13:53:03 -08:00
Felix Rieseberg
451a44c4b5 🔧 Don’t use deprecated new Buffer() 2017-11-23 13:41:47 -08:00
Felix Rieseberg
05bae0b4c4 🔧 Util is no longer used here 2017-11-20 09:52:13 -08:00
Felix Rieseberg
71b8eaf085 🔧 Don’t use deprecated util.is* methods 2017-11-20 09:40:47 -08:00
Felix Rieseberg
c9f2080e4b 🔧 fs.readFile: options are optional 2017-11-20 08:20:20 -08:00
Siyuan Liu
f56abac7a8 fix linting error 2017-08-01 17:52:48 +08:00
Siyuan Liu
5a48c1feed fixes 10128 2017-07-31 09:32:45 +08:00
Kevin Sawicki
bea1a0643c Memoize ELECTRON_NO_ASAR env var check 2016-11-16 07:37:53 -08:00
Kevin Sawicki
f553d16539 Only support ELECTRON_NO_ASAR in non browser/renderer processes 2016-10-12 11:11:27 -07:00
Benjamin Pasero
656ee0d9c3 introduce ELECTRON_NO_ASAR 2016-10-12 11:11:27 -07:00
Kevin Sawicki
902bd0564e Require Buffer explicitly instead of relying on global 2016-09-08 10:17:06 -07:00
Kevin Sawicki
46fbb6ed61 Reset process.noAsar in finally block 2016-09-06 13:40:25 -07:00
Kevin Sawicki
8eca019157 Support paths as Buffers 2016-07-25 11:10:36 -07:00
Kevin Sawicki
30fbe92970 Add asar-supported fs.accessSync implementation 2016-07-25 11:05:18 -07:00
Kevin Sawicki
3ad5504194 Add asar-supported fs.access implementation 2016-07-25 10:50:30 -07:00
Kevin Sawicki
a518c47f4c Use let/const instead of var 2016-07-25 10:43:38 -07:00
Felix Rieseberg
bef6748c06 🎨 Implement JS Standard Code Style 7
Updates Standard Code Style to 7 (latest major) and ensures that code
is conform.

 * camelCase is now enforced
 * No assignments in return statements
2016-05-25 16:20:49 -07:00
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
Zeke Sikelianos
42e7ee2b4a finish standardizing! 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
e6698102c9 standardize by hand 2016-03-30 17:00:33 -07:00
Zeke Sikelianos
c4b6cf4a8e do more manual cleanup and specify globals 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
67fa250020 standardize asar.js by hand 2016-03-30 17:00:31 -07:00
Kevin Sawicki
4f4dc2f4d8 Use destructuring assigment 2016-03-22 13:11:42 -07:00
Kevin Sawicki
3a1e837f8b Don't collect results in exit event callback 2016-03-11 08:55:47 -08:00
Kevin Sawicki
70aa9b06ee Move JavaScript to root lib/ folder 2016-03-08 11:14:21 -08:00
Renamed from atom/common/lib/asar.js (Browse further)