示例#1
0
        public async Task <Either <PowershellFailure, Unit> > RunAsync(PsCommandBuilder builder, Func <int, Task> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeAsyncProgressReporting(ps, reportProgress);
                return(await ps.RunAsync().ConfigureAwait(false));
            }
        }
示例#2
0
        public async Task <Either <PowershellFailure, Seq <TypedPsObject <T> > > > GetObjectsAsync <T>(PsCommandBuilder builder, Func <int, Task> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);
                InitializeAsyncProgressReporting(ps, reportProgress);

                return(await ps.GetObjectsAsync <T>().ConfigureAwait(false));
            }
        }
示例#3
0
        public Either <PowershellFailure, Unit> Run(PsCommandBuilder builder, Action <int> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeProgressReporting(ps, reportProgress);
                return(ps.Run());
            }
        }
示例#4
0
        public Either <PowershellFailure, Seq <TypedPsObject <T> > > GetObjects <T>(PsCommandBuilder builder, Action <int> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeProgressReporting(ps, reportProgress);
                return(ps.GetObjects <T>());
            }
        }