Sign in to follow this  
Endurion

C#, External Commands

Recommended Posts

Endurion    5411
I'm working on a C64 IDE (C#, C64Studio). Most of the common stuff is down and working nicely. I'm using .NET 2.0 with C#, Visual Studio 2008.

I've hit a snag I'd like to overcome:


I'm trying to implement pre, custom and post build scripts analog Visual Studio. The plan is to have a command script (one or several commands) which need to be processed. If one command fails skip the following commands.


My first attempt was to use System.Diagnostics.Process with cmd.exe, /K as startup arg and feed the commands per [size="2"]StandardInput. That works fine, however I don't notice if any one of the commands fail. I obviously get the result of cmd.exe itself.


If I use every line by itself the basic commands won't work (because they're implemented by cmd.exe, not as standalone files).



How would one go about this? I want the result of every single command and be able to capture output and error streams.


I could try to analyze the commands and if the common "copy" or other commands appear redirect them to cmd.exe, but that sounds rather fragile.
[/size]

Share this post


Link to post
Share on other sites
Endurion    5411
Ok, I found a workaround: I'm using the switch /C and call the cmd process for every line in the script.


Not really elegant but seems to do the trick. If anybody knows a cleaner way I'd be happy to hear about it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this