Skip to content

Commit 669c522

Browse files
committed
fix missing commandName on return obj
1 parent bfdd924 commit 669c522

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

psCommandService.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,25 @@ PSCommandService.prototype.generateCommand = function(commandName, argument2Valu
107107
* command registry, applying the values from the argument map
108108
* returns a promise that when fulfilled returns the cmdResult
109109
* object from the command which contains properties
110-
* (command, stdout, stderr)
110+
* {commandName: name, command:generatedCommand, stdout:xxxx, stderr:xxxxx}
111111
*
112112
* On reject an Error object
113113
*
114114
* @param array of commands
115115
*/
116116
PSCommandService.prototype.execute = function(commandName, argument2ValueMap) {
117117
var command = this.generateCommand(commandName, argument2ValueMap);
118-
return this._execute(command);
118+
var self = this;
119+
return new Promise(function(fulfill,reject) {
120+
self._execute(command)
121+
.then(function(cmdResult) {
122+
// tack on commandName
123+
cmdResult['commandName'] = commandName;
124+
fulfill(cmdResult);
125+
}).catch(function(error){
126+
reject(error);
127+
});
128+
});
119129
}
120130

121131
/**

0 commit comments

Comments
 (0)