Skip to content

Commit

Permalink
Merge pull request #1 from perrylets/change-shell
Browse files Browse the repository at this point in the history
Change Shell and other stuff
  • Loading branch information
perrylets authored Aug 13, 2023
2 parents 3878951 + 5b96089 commit 01cc8df
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Publish to NuGet

on:
release:
types: [published]
types: published

jobs:
publish:
Expand All @@ -22,6 +22,6 @@ jobs:
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
- name: Pack
run: dotnet pack /p:PackageVersion=${{github.event.release.tag_name}} -c Release CommandExec/CommandExec.csproj --no-build --output .
run: dotnet pack /p:Version=${{github.event.release.tag_name}} -c Release CommandExec/CommandExec.csproj --no-build --output .
- name: Publish to NuGet
run: dotnet nuget push *.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
7 changes: 4 additions & 3 deletions CommandExec.Tests/EnvironmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ public void ShellCommandTest()
.Run();

string STDOut = shell.STDOut.ReadToEnd().TrimEnd();
string STDErr = shell.STDErr.ReadToEnd().TrimEnd();

Assert.Equal("test", STDOut);
Assert.Equal(string.Empty, STDErr);

//! There can be errors with the shell itself, not the process.
// string STDErr = shell.STDErr.ReadToEnd().TrimEnd();
// Assert.Equal(string.Empty, STDErr);
}
}
2 changes: 1 addition & 1 deletion CommandExec/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Task RunAsync(params string[] args)
/// <returns>The command used to run the shell.</returns>
public static Command Shell(params string[] args)
{
(string shellCommand, string shellArg) = isUnix ? ("bash", "-c") : ("cmd.exe", "/C");
(string shellCommand, string shellArg) = isUnix ? ("bash", "-c") : ("powershell.exe", string.Empty);
Command shell = new Command(shellCommand)
.AddArg(shellArg);

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Task dotnetTask = dotnet.RunAsync(); // Runs asynchronously.
Console.WriteLine("Dotnet help running...");
await dotnetTask;

Command shell = Command.Shell("dotnet", "--help"); // Creates the command for a shell. cmd.exe on Windows, bash on Linux/macOS.
shell.Run(); // Passing args with `Run` for shell command is not advised.
Command shell = Command.Shell("dotnet", "--help"); // Creates the command for a shell. PowerShell on Windows, BASH on Linux/macOS.
shell.Run(); // Passing args with `Run` for shell command is not recommended.
```

Check more information about the `Command` class in the [Wiki (empty for now)](https://github.com/perrylets/CommandExec/wiki) or the doc comments.

0 comments on commit 01cc8df

Please sign in to comment.