Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 28c208a

Browse files
committed
Fixed python process environment inheritance
1 parent 8b20fa9 commit 28c208a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"name": "python-runner",
44
"description": "Library that helps you call python code on node.",
5-
"version": "1.0.3",
5+
"version": "1.1.0",
66

77
"author": {
88
"name" : "Oscar Brito",

src/exec.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ var _ = require("lodash"),
88
/**
99
*
1010
* Convert to variables
11-
*
11+
*
1212
* @param {Object} variables
1313
* @return {Array}
14-
*
14+
*
1515
*/
1616
var toVariables = function(variables){
1717

1818
variables = variables || {};
19-
19+
2020
var vars = [];
2121
_.each(variables, function(value, name){
22-
22+
2323
if(typeof(value) == "number"){
24-
vars.push(
25-
_.template("<%= name %> = <%= value %>", { name: name, value: value }));
24+
vars.push(
25+
_.template("<%= name %> = <%= value %>", { name: name, value: value }));
2626
}
2727
else{
28-
vars.push(
28+
vars.push(
2929
_.template("<%= name %> = '<%= value %>'", { name: name, value: value }));
3030
}
31-
31+
3232
});
3333

3434
return vars;
@@ -37,28 +37,28 @@ var toVariables = function(variables){
3737

3838
/**
3939
*
40-
* Manages the execution of the python process. Once the code is executed the
40+
* Manages the execution of the python process. Once the code is executed the
4141
* promise is resolved with the stdout of the process.
4242
*
4343
* @param {String} code
4444
* @param {Object} options
45-
*
45+
*
4646
* @return {Promise}
47-
*
47+
*
4848
*/
4949
var exec = function(code, options){
5050

5151
options = options || {};
5252
options.bin = options.bin || "python";
5353
options.vars = options.vars || {};
5454
options.env = _.extend({},
55-
process.env,
5655
{
5756
/// set the env PYTHONPATH
5857
PYTHONPATH: ""
59-
},
58+
},
59+
process.env,
6060
options.env);
61-
61+
6262

6363
var dfd = Q.defer(),
6464
output = [];
@@ -79,7 +79,7 @@ var exec = function(code, options){
7979
python.stderr.on('data', function(data){
8080
dfd.reject(data.toString());
8181
});
82-
82+
8383
python.stdout.on('close', function(code){
8484

8585
var result = output.join().trim();

0 commit comments

Comments
 (0)