Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #950: Added support for listing installed Python packages using `list -python`, `list -py` and `list-installed -python`
- #822: The CPF resource processor now supports system expressions and macros in CPF merge files
- #578 Added functionality to record and display IPM history of install, uninstall, load, and update
- #996:Ensure COS commands execute in exec under a dedicated, isolated context

### Changed
- #316: All parameters, except developer mode, included with a `load`, `install` or `update` command will be propagated to dependencies
Expand Down
14 changes: 12 additions & 2 deletions src/cls/IPM/Main.cls
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,7 @@ ClassMethod ShellInternal(
} elseif (tCommandInfo = "load") {
do ..Load(.tCommandInfo)
} elseif (tCommandInfo = "exec") {
write !
xecute tCommandInfo("parameters","expression")
do ..ExecuteCOS(.tCommandInfo)
} elseif (tCommandInfo = "install") {
do ..Install(.tCommandInfo)
} elseif (tCommandInfo = "reinstall") {
Expand Down Expand Up @@ -2213,6 +2212,17 @@ ClassMethod Load(
$$$ThrowOnError(log.Finalize($$$OK, devMode))
}

ClassMethod ExecuteCOS(ByRef tCommandInfo)
{
set namespace = $namespace
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new $namespace line before this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Added the new $namespace and removed the set namespace = $namespace

try {
write !
xecute tCommandInfo("parameters","expression")
} catch ex {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just throw the error and let the exception handling of ShellInternal() handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Added the $$$ThrowOnError inside catch block.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity's sake, I don't think we need this extra try/catch block in this method. The error should be propagatable up the call stack, so essentially just

ClassMethod ExecuteCOS(ByRef tCommandInfo)
{
new $namespace
write !
xecute commandInfo("parameters","expression")
}

Also minor nit: remove the t- prefixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing. I have updated the method to use the minimalist approach as suggested. I removed the try/catch block and the t- prefixes from the variables.

}
set $namespace = namespace
}

ClassMethod LoadInternal(
ByRef pCommandInfo,
pLog As %IPM.General.AbstractHistory) [ Internal ]
Expand Down