Skip to content

Commit 8db0828

Browse files
committed
Dot-source debugged scripts into the shared session
This change causes scripts executed in the debugger to be dot-sourced into the shared session so that the functions defined in the script can be experimented with after debugging is complete. Resolves PowerShell/vscode-powershell#540.
1 parent f176687 commit 8db0828

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/PowerShellEditorServices/Session/PowerShellContext.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,16 @@ public async Task ExecuteScriptWithArgs(string script, string arguments = null,
699699
// Related to issue #123.
700700
if (File.Exists(script) || File.Exists(scriptAbsPath))
701701
{
702-
script = EscapePath(script, escapeSpaces: true);
702+
// Dot-source the launched script path
703+
script = ". " + EscapePath(script, escapeSpaces: true);
703704
}
704705

705706
launchedScript = script + " " + arguments;
706-
command.AddScript(launchedScript);
707+
command.AddScript(launchedScript, false);
707708
}
708709
else
709710
{
710-
command.AddCommand(script);
711+
command.AddCommand(script, false);
711712
}
712713

713714
if (writeInputToHost)

0 commit comments

Comments
 (0)