/// <inheritdoc /> public Task <PlaceFileResult> PlaceFileAsync( Context context, ContentHash contentHash, AbsolutePath path, FileAccessMode accessMode, FileReplacementMode replacementMode, FileRealizationMode realizationMode, CancellationToken cts, UrgencyHint urgencyHint) { return(PlaceFileCall <ContentSessionTracer> .RunAsync(Tracer.ContentSessionTracer, new OperationContext(context), contentHash, path, accessMode, replacementMode, realizationMode, async() => { if (WriteThroughContentSession != null) { var writeThroughResult = await WriteThroughContentSession.PlaceFileAsync(context, contentHash, path, accessMode, replacementMode, realizationMode, cts, urgencyHint).ConfigureAwait(false); if (writeThroughResult.Succeeded || writeThroughResult.Code != PlaceFileResult.ResultCode.NotPlacedContentNotFound) { UnixHelpers.OverrideFileAccessMode(_overrideUnixFileAccessMode, path.Path); return writeThroughResult; } } var backingResult = await BackingContentSession.PlaceFileAsync(context, contentHash, path, accessMode, replacementMode, realizationMode, cts, urgencyHint); UnixHelpers.OverrideFileAccessMode(_overrideUnixFileAccessMode, path.Path); return backingResult; })); }
protected override void EndProcessing() { if (Completer == null) { string shellName = Shell ?? ShellType.ToString().ToLower(); if (!UnixHelpers.TryFindShell(shellName, out string shellPath, out ShellType shellType)) { ThrowTerminatingError( new ErrorRecord( new ItemNotFoundException($"Unable to find shell '{shellName}'"), "CompletionShellNotFound", ErrorCategory.ObjectNotFound, shellName)); return; } // Allow a scenario where a shell is named one thing but behaves as another // and the user has manually specified what shell it behaves as if (ShellType != ShellType.None) { shellType = ShellType; } switch (shellType) { case ShellType.Zsh: Completer = new ZshUtilCompleter(shellPath); break; case ShellType.Bash: Completer = new BashUtilCompleter(shellPath); break; default: ThrowTerminatingError( new ErrorRecord( new ArgumentException($"Unable to create a completer for shell type '{shellType}'"), "InvalidCompletionShellType", ErrorCategory.InvalidArgument, shellType)); return; } } CompleterGlobals.UnixUtilCompleter = Completer; }