I'm on a windows 10 environment writing a plugin for the Atom text editor to allow running tests through protractor cucumber from within atom it consumes the PlatformIO-Terminal plugin's provided service. When I activate that terminal plugin from within Atom I'd expect to be able to execute any old program from it that I could from my terminal that it's emulating through pty.
I'm having trouble executing any node program I've installed via npm outside of Atom's apm. Further digging via printing the environment variable NODE_PATH from within that terminal revealed that Atom has eaten my NODE_PATH value, not appended it's own but completely consumed and replaced it. Resetting it from within that pty window doesn't work, and neither does adding it to the "Shell Environment Variables" from within the PlatformIO configuration terminal. I've installed 3 plugins which allow pulling in environment variables from the OS, and none of them have succeeded.
Is there a way to solve this problem? I can access the executable modules directly, but they call other ones and depend on NODE_PATH.
If you aren't having success with terminal packages, you might try process-palette
. It allows you to precisely define all of the details of the command, including environment variables. I've made an Atom command that sets NODE_ENV
to an arbitrary string before executing a terminal command. Screenshots below:
Below is a process-palette.json
file that defines the command I wrote. All you have to do to get started is install the package, make that file with the following code, and select Packages -> Process Palette -> Edit Configuration
.
{
"patterns": {
"P1": {
"expression": "(path):(line)"
},
"P2": {
"expression": "(path)\\s+(line)",
"path": "(?:\\/[\\w\\.\\-]+)+"
}
},
"commands": [
{
"namespace": "process-palette",
"action": "env",
"command": "echo %NODE_PATH%",
"arguments": [],
"cwd": null,
"inputDialogs": [],
"env": {
"NODE_PATH": "wargarble"
},
"keystroke": null,
"stream": true,
"outputTarget": "panel",
"outputBufferSize": 80000,
"maxCompleted": 3,
"autoShowOutput": true,
"autoHideOutput": false,
"scrollLockEnabled": false,
"singular": false,
"promptToSave": true,
"saveOption": "none",
"patterns": [
"default"
],
"successOutput": "{stdout}",
"errorOutput": "{stdout}\n{stderr}",
"fatalOutput": "Failed to execute : {fullCommand}\n{stdout}\n{stderr}",
"startMessage": null,
"successMessage": "Executed : {fullCommand}",
"errorMessage": "Executed : {fullCommand}\nReturned with code {exitStatus}\n{stderr}",
"fatalMessage": "Failed to execute : {fullCommand}\n{stdout}\n{stderr}",
"menus": [
"env"
],
"startScript": null,
"successScript": null,
"errorScript": null,
"scriptOnStart": false,
"scriptOnSuccess": false,
"scriptOnError": false,
"notifyOnStart": false,
"notifyOnSuccess": true,
"notifyOnError": true,
"input": null
}
]
}