Skip to content

Bring back the success checks in usershell/localusergroupshell #4

@GieltjE

Description

@GieltjE

Couldn't something like this fix the success check (it is language invariant), :

        public (ICollection<PSObject> result, Boolean success) Execute(String scriptFullPath, ICollection<CommandParameter> parameters, Boolean ignoreErrorStream = false)
        {
            String script = _embededFileReader.Read(scriptFullPath);

            using (Runspace runspace = RunspaceFactory.CreateRunspace())
            {
                runspace.Open();

                using (Pipeline pipeline = runspace.CreatePipeline())
                {
                    pipeline.Commands.Add(CreateCommand(parameters, script));

                    Collection<PSObject> results = pipeline.Invoke();

                    if (!ignoreErrorStream)
                    {
                        ThrowFromErrorStream(pipeline);
                    }

                    return (results, !pipeline.HadErrors);
                }
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions