From f214e887843e0982adccf125a771a95b80126a51 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 4 Feb 2015 10:52:09 -0800 Subject: [PATCH] spec: Script forked with child_process supports asar archives --- spec/asar-spec.coffee | 8 ++++++++ spec/fixtures/module/asar.js | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 spec/fixtures/module/asar.js diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index ae0526f9..ab96d7ee 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -347,6 +347,14 @@ describe 'asar package', -> throws = -> child_process.fork p assert.throws throws, /ENOENT/ + it 'supports asar in the forked js', (done) -> + file = path.join fixtures, 'asar', 'a.asar', 'file1' + child = child_process.fork path.join(fixtures, 'module', 'asar.js') + child.on 'message', (content) -> + assert.equal content, fs.readFileSync(file).toString() + done() + child.send file + describe 'asar protocol', -> url = require 'url' remote = require 'remote' diff --git a/spec/fixtures/module/asar.js b/spec/fixtures/module/asar.js new file mode 100644 index 00000000..1fb87508 --- /dev/null +++ b/spec/fixtures/module/asar.js @@ -0,0 +1,4 @@ +var fs = require('fs'); +process.on('message', function(file) { + process.send(fs.readFileSync(file).toString()); +}); -- 2.43.0