phantom-workers
Advanced tools
| var port = require("system").env['PHANTOM_WORKER_PORT']; | ||
| var host = require("system").env['PHANTOM_WORKER_HOST']; | ||
| var env = require("system").env['PHANTOM_TEST_ENV']; | ||
| require('webserver').create().listen(host + ':' + port, function (req, res) { | ||
| res.statusCode = 200; | ||
| res.write(JSON.stringify({value: env})); | ||
| res.close(); | ||
| }); |
@@ -18,2 +18,3 @@ /*! | ||
| this.options = options || {}; | ||
| this.options.workerEnv = this.options.workerEnv || {}; | ||
| this.options.numberOfWorkers = this.options.numberOfWorkers || numCPUs; | ||
@@ -49,3 +50,4 @@ this.options.timeout = this.options.timeout || 180000; | ||
| portRightBoundary: self.options.portRightBoundary, | ||
| phantomPath: self.options.phantomPath | ||
| phantomPath: self.options.phantomPath, | ||
| env: self.options.workerEnv | ||
| })); | ||
@@ -52,0 +54,0 @@ self._phantomInstances[i].start(function(err) { |
@@ -85,3 +85,3 @@ var childProcess = require('child_process'), | ||
| var childOpts = { | ||
| env: {} | ||
| env: self.options.env | ||
| }; | ||
@@ -88,0 +88,0 @@ |
+1
-1
| { | ||
| "name": "phantom-workers", | ||
| "version": "0.3.3", | ||
| "version": "0.4.0", | ||
| "author": { | ||
@@ -5,0 +5,0 @@ "name": "Jan Blaha", |
+2
-1
@@ -61,3 +61,4 @@ #phantom-workers | ||
| `phantomPath` - path to the phantomjs library. If not specified, this will use the version of phantom declared in the `optionalDependencies` in `package.json`<br/> | ||
| `proxy,proxy-type,proxy-auth` - see phantomjs arguments for proxy setting details | ||
| `proxy,proxy-type,proxy-auth` - see phantomjs arguments for proxy setting details | ||
| `workerEnv` - object with additional environment variables passed to the phantom process | ||
@@ -64,0 +65,0 @@ ##phantomjs2 |
+22
-0
@@ -181,2 +181,24 @@ var should = require("should"), | ||
| }); | ||
| it("should be able to provide custom worker env variables", function (done) { | ||
| phantomManager = new PhantomManager({ | ||
| pathToPhantomScript: path.join(__dirname, "test-script", "env.js"), | ||
| workerEnv: { | ||
| "PHANTOM_TEST_ENV": "test" | ||
| }, | ||
| numberOfWorkers: 1 | ||
| }); | ||
| phantomManager.start(function(err) { | ||
| if (err) | ||
| return done(err); | ||
| phantomManager.execute({}, function (err, res) { | ||
| if (err) | ||
| return done(err); | ||
| res.value.should.be.eql('test'); | ||
| done(); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
25302
5.17%15
7.14%528
5.81%77
1.32%