Fix win execution with whitespace in username #351
This commit addresses the issue where scripts fail to execute on Windows environments with usernames containing spaces. The problem stemmed from PowerShell and cmd shell's handling of spaces in quoted arguments. The solution involves encoding PowerShell commands before execution, which mitigates the quoting issues previously causing script failures. This approach is now integrated into the execution flow, ensuring that commands are correctly handled irrespective of user names or other variables that may include spaces. Changes: - Implement encoding for PowerShell commands to handle spaces in usernames and other similar scenarios. - Update script documentation URLs to reflect changes in directory structure. Fixes #351
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { PowerShellInvokeShellCommandCreator } from '@/infrastructure/CodeRunner/Execution/CommandDefinition/Commands/PowerShellInvoke/PowerShellInvokeShellCommandCreator';
|
||||
import { StubWithObservableMethodCalls } from './StubWithObservableMethodCalls';
|
||||
|
||||
export class PowerShellInvokeShellCommandCreatorStub
|
||||
extends StubWithObservableMethodCalls<PowerShellInvokeShellCommandCreator>
|
||||
implements PowerShellInvokeShellCommandCreator {
|
||||
private command: string | undefined;
|
||||
|
||||
public withCreatedCommand(command: string): this {
|
||||
this.command = command;
|
||||
return this;
|
||||
}
|
||||
|
||||
public createCommandToInvokePowerShell(powerShellCommand: string): string {
|
||||
this.registerMethodCall({
|
||||
methodName: 'createCommandToInvokePowerShell',
|
||||
args: [powerShellCommand],
|
||||
});
|
||||
if (this.command === undefined) {
|
||||
return `[${PowerShellInvokeShellCommandCreatorStub.name}] ${powerShellCommand}`;
|
||||
}
|
||||
return this.command;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user