Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions lib/atom-python-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
'command': atom.config.get(`atom-python-run.${key}Command`),
'pause': atom.config.get(`atom-python-run.${key}Pause`),
});
}
}
} catch(error) {
// the promise failed and the exception was caught
console.log(`atom-python-run: saveAndRun: ${error}`);
Expand All @@ -48,14 +48,32 @@ module.exports = {
let args = config.command.split(' ');

// load configuration settings in to 'config' object

config = Object.assign(config, {
'terminal': atom.config.get('atom-python-run.terminal'),
'pipeFile': atom.config.get('atom-python-run.pipeFile'),
'pipePath': atom.config.get('atom-python-run.pipePath'),
'extensions': atom.config.get('atom-python-run.extensionFilter'),
'consoleLog': atom.config.get('atom-python-run.consoleLog')
'consoleLog': atom.config.get('atom-python-run.consoleLog'),
'f5envVariables': atom.config.get('atom-python-run.f5envVariables') // Environment Variables
});

let tmpEnv = {};
var tmpArr = []

// Extracting the env Variables from array format

for (var i = 0; i < config.f5envVariables.length; i++) {
if(config.f5envVariables[i].includes(":")){
tmpArr = config.f5envVariables[i].split(":")
if(tmpArr.length==2){
tmpEnv[tmpArr[0]] = tmpArr[1];
}
}
}

// console.log(tmpEnv);

function format(string, object) {
return string.replace(/{.*?}/g, (element) =>
object[element.substring(1, element.length - 1)]
Expand Down Expand Up @@ -118,7 +136,8 @@ module.exports = {
'args': args,
'options': {
cwd: info.dir,
detached: true
detached: true,
env: tmpEnv // Passing Environment variables to the shell instance
}
});

Expand Down Expand Up @@ -160,6 +179,16 @@ module.exports = {
type: 'string',
default: 'python {file}'
},
/////// Env Variables option
f5envVariables: {
title: 'Environment Variables',
description: 'format [key:pair, key:pair ...]',
type: 'array',
default: [],
items:{
type: "string"
}
},
f6Command: {
title: 'F6 Command',
description: 'Same as above',
Expand Down