]> khamidou — GitHub mirrors - electron.git/commitdiff
spec: Script forked with child_process supports asar archives
authorCheng Zhao <zcbenz@gmail.com>
Wed, 4 Feb 2015 18:52:09 +0000 (10:52 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 4 Feb 2015 18:52:09 +0000 (10:52 -0800)
spec/asar-spec.coffee
spec/fixtures/module/asar.js [new file with mode: 0644]

index ae0526f9fe1b7090824aac7032b2a0a1958e12ef..ab96d7ee3d6f124556d9e93ede69687963c08172 100644 (file)
@@ -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 (file)
index 0000000..1fb8750
--- /dev/null
@@ -0,0 +1,4 @@
+var fs = require('fs');
+process.on('message', function(file) {
+  process.send(fs.readFileSync(file).toString());
+});