Skip to content

Commit 6f250c9

Browse files
Merge pull request #249 from PowershellFrameworkCollective/module-root
Include PSFramework in logging runspace
2 parents 61feaaa + be3f40a commit 6f250c9

7 files changed

Lines changed: 25 additions & 1 deletion

File tree

PSFramework/bin/PSFramework.dll

0 Bytes
Binary file not shown.

PSFramework/bin/PSFramework.pdb

2 KB
Binary file not shown.

PSFramework/bin/PSFramework.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PSFramework/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Upd: PsfValidateScript will now understand both $_ and $args[0]
1212
- Upd: PsfValidateSet now supports localized strings using the `ErrorString` property.
1313
- Upd: PsfValidateScript now supports localized strings using the `ErrorString` property.
14+
- Upd: Logging runspace now loads the same copy of PSFramework that spawned it (#238)
1415
- Fix: PsfValidateSet fails on completion scriptblock with whitespace value
1516
- Fix: Get-PSFConfig will show bad value in default table. Correct data still stored (#243)
1617

PSFramework/internal/scripts/async-logging2.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
{
44
$script:___ScriptName = 'PSFramework.Logging'
55

6+
Import-Module (Join-Path ([PSFramework.PSFCore.PSFCoreHost]::ModuleRoot) 'PSFramework.psd1')
7+
68
while ($true)
79
{
810
# This portion is critical to gracefully closing the script

PSFramework/internal/scripts/environment.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ if (($PSVersionTable.PSVersion.Major -ge 6) -and ($PSVersionTable.OS -notlike "*
8585
$script:NoRegistry = $true
8686
}
8787

88-
if (-not ([PSFramework.Message.LogHost]::LoggingPath)) { [PSFramework.Message.LogHost]::LoggingPath = $script:path_Logging }
88+
if (-not ([PSFramework.Message.LogHost]::LoggingPath)) { [PSFramework.Message.LogHost]::LoggingPath = $script:path_Logging }
89+
90+
[PSFramework.PSFCore.PSFCoreHost]::ModuleRoot = $script:ModuleRoot

library/PSFramework/PSFCore/PSFCoreHost.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,19 @@ public static class PSFCoreHost
1515
/// Whether the current console is in unattended mode
1616
/// </summary>
1717
public static bool Unattended = false;
18+
19+
/// <summary>
20+
/// The path to where the module was imported from
21+
/// </summary>
22+
public static string ModuleRoot
23+
{
24+
get { return _ModuleRoot; }
25+
set
26+
{
27+
if (String.IsNullOrEmpty(_ModuleRoot))
28+
_ModuleRoot = value;
29+
}
30+
}
31+
private static string _ModuleRoot;
1832
}
1933
}

0 commit comments

Comments
 (0)