Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements #177 #1

Merged
merged 4 commits into from
May 28, 2019
Merged

Implements #177 #1

merged 4 commits into from
May 28, 2019

Conversation

MVKozlov
Copy link
Owner

Fixes proxb#177 .

beargle added 4 commits March 5, 2018 22:31
Add parameter `ModulesFromPathToImport` that accepts a single path, from
which module(s) will be imported into background runspace jobs. Modules
in this path are not required to be listed by name, and the path does
not have to exist in `$env:PSModulePath`.
When the '-ModulesFromPathToImport' parameter is passed for
'Start-RSJob', it should handle either a full and relative path name.

Also raise an exception if the module(s) path is not found, which means
none of the module(s) are imported in the runspace job. An exception
prevents the runspace jobs from starting, as any dependent functions
referenced inside the 'ScriptBlock' parameter would not be found.
`Resolve-Path` fires a non-terminating error when it can't find a
specified path, which means the error isn't caught for handling
in a Catch block. Make `Resolve-Path` raise a terminating error,
so we can re-throw to add context to the original exception message.
Remove separate '-ModulesFromPathToImport' parameter, adding this
functionality to existing '-ModulesToImport' parameters. This means
'-ModulesToImport' can accept a collection containing:

 - Installed module names
 - Path (full or relative) containing one or more modules
 - Path (full or relative) to a module manifest, script module, or
   binary module file

Purpose of consolidation is to simplify module import for the caller;
They should have the flexibility to pass a root module path for
recursive import, or be able to specify modules similar to `Import-Module`,
with minimal preprocessing of the parameter collection.
@MVKozlov MVKozlov merged commit f5b6993 into MVKozlov:master May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ImportPSModulesFromPath support
2 participants