-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set environment variables #6
Conversation
… a Cancelled variable Also trying to figure out why it isn't compiling on .NET Standard
But apparently you can only set env variables on the full .NET
Thanks for PR. |
CliWrap/CliWrap.csproj
Outdated
@@ -15,4 +15,16 @@ | |||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> | |||
</PropertyGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for adding these packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't compile with .NET Standard and Core, but it doesn't work anyway so I'll try to remove them.
CliWrap/Cli.cs
Outdated
@@ -41,9 +42,9 @@ public Cli(string filePath) | |||
{ | |||
} | |||
|
|||
private Process CreateProcess(string arguments) | |||
private Process CreateProcess(string arguments, Dictionary<string, string> env = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, just pass ExecutionInput instead of two parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was gonna do that, thought you might prefer it this way,
CliWrap/Cli.cs
Outdated
{ | ||
foreach (var item in env) | ||
{ | ||
#if NET45 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works in .net standard 2.0 too so use #if NET45 && NETSTANDARD2_0
or however you write the net std moniker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have absolutely no idea how those .NET things work, so sorry about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When compiling .NET Standard it says that the type isn't found, I guess it doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely works for me. You sure you have the net standard 2.0 sdk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I'll install it and try again.
CliWrap/Cli.cs
Outdated
@@ -118,7 +131,7 @@ public ExecutionOutput Execute(ExecutionInput input, CancellationToken cancellat | |||
var stdOut = stdOutBuffer.ToString(); | |||
var stdErr = stdErrBuffer.ToString(); | |||
|
|||
return new ExecutionOutput(process.ExitCode, stdOut, stdErr); | |||
return new ExecutionOutput(process.ExitCode, stdOut, stdErr, cancellationToken.IsCancellationRequested); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove the cancellation token thing here
CliWrap/Models/ExecutionInput.cs
Outdated
/// <summary> | ||
/// Environment variables for the process | ||
/// </summary> | ||
public Dictionary<string, string> EnvironmentVariables { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDictionary<string, string>
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Okay thank you. I'll finish the PR before merging. |
Please don't commit to this branch past this point. :p |
I have installed the SDK and it still doesn't compile for me, it can't find |
As promised, I added support for environment variables, although they only work in the full .NET framework AFAIK.