Runtime: Running bash shell programmatically on Mac OS X

Created on 3 Feb 2017  路  7Comments  路  Source: dotnet/runtime

I am trying to figure out how to run a bash shell using .NET Core. Specifically, I want to run a bash shell, run a dotnet [path to dll] command and pass commands to the dll. I tried looking through the test classes in System.Diagnostics.Process but I couldn't wrap my head around it. :(

What I hope to achieve is something like on the .NET Framework:

Process.Start("bash dotnet a.dll start")

Please let me know if I'm asking the question in the appropriate area. :)

I am running Mac OSX El Capitan 10.11.6

Thank you!

area-System.Diagnostics.Process question

Most helpful comment

Wow, dotnet core is so cool. I am programming using VB.net in Visual Studios on my windows computer and running my code on my mac. So cool...

All 7 comments

Have you tried using the Process.Start method? It should work fine. This command (bash dotnet a.dll start) doesn't look valid to me (you might want bash -c), but other than that, there shouldn't be any problems.

@mellinoe Yeah, that command probably isn't valid as it was just pseudocode. I haven't tried anything yet. What would I pass in as the argument?

The easiest option is just to call this method: https://msdn.microsoft.com/en-us/library/h6ak8zt5(v=vs.110).aspx. The same exact method is available on .NET Core.

Examples:

C# Process.Start("bash", "-c dotnet --info"); Process.Start("dotnet", "a.dll start");

@akcorp2003 Did the proposed methods work for you?

@Priya91 Process.Start("dotnet", "a.dll"); will work, I have done that all the time.

@Priya91 Sorry, I was behind a network that wasn't allowing me to do nuget (probably I didn't set the proxy).

But yeah, it worked!!

Wow, dotnet core is so cool. I am programming using VB.net in Visual Studios on my windows computer and running my code on my mac. So cool...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Timovzl picture Timovzl  路  3Comments

noahfalk picture noahfalk  路  3Comments

nalywa picture nalywa  路  3Comments

omajid picture omajid  路  3Comments

EgorBo picture EgorBo  路  3Comments