Comments (7)
Hi @drpeck, thanks for raising this.
It sounds like the executable you are running is not well behaved. When it fails, if there is additional diagnostic information about the failure, in addition to the exit code, I would expect that information to be written to stderr, not stdout. Is the source code of the executable under your control? If so, I would first consider changing it to write the diagnostic information to stderr.
from simple-exec.
It's not under my control unfortunately. TBH I didn't/don't really understand stderr stuff, but I have managed to add a 2> error.log
to pipe the errors to a file and I can read it from there.
It would be nice if it were handled all within managed code, but I'm sure it's not straightforward.
Thanks for your hard work.
from simple-exec.
I see, so it seems that the executable is well behaved, but you are invoking SimpleExec in a context where you don't see stderr in the console.
I need to give this a little more thought. This problem may belong slightly outside the simple contexts that SimpleExec is designed for. I'll get back to you ASAP.
In the meantime, the workaround you are using sounds fine for now.
from simple-exec.
BTW, I'm not sure I understand your listed alternative:
We could create
Command.TryReadAsync
which doesn't through an exception but the return type would state the error code.
It doesn't seem to address the problem you are facing, and it's possible to capture the exit code and swallow the exception today:
string output;
int exitCode;
try
{
output = Read("foo.exe");
}
catch (ExitCodeException ex) // in 7.x you have to catch NonZeroExitCodeException
{
exitCode = ex.ExitCode;
}
from simple-exec.
from simple-exec.
Well, the exception still doesn't give you the contents of stderr (or stdout). It only gives you the exit code. To be able to see the contents of stderr you need your 2> error.log
workaround (or a new feature in SimpleExec).
BTW —
TBH I didn't/don't really understand stderr stuff...
The Wikipedia page has a good explanation.
from simple-exec.
@drpeck this will covered by #351
Thanks again for raising this.
from simple-exec.
Related Issues (20)
- New API for version 9 HOT 7
- Echo to standard out instead of standard error HOT 1
- 9.0.0 release HOT 5
- Can not use in Windows 10, even for simple command. HOT 1
- Nullable annotations HOT 2
- Linux & child process HOT 1
- Overloads with argument lists HOT 3
- 9.1.0 release
- 10.0.0 release
- Automatically resolve .cmd and .bat paths on Windows HOT 2
- Reactive API
- The automatic windows parameter doesn't work for powershell scripts HOT 9
- PATHEXT file extension order is not respected on Windows HOT 1
- 11.0.0 release
- Read while displaying standard & error output in real time HOT 3
- Reg Query Error! HOT 3
- Providing the possibility to kill not only a process, but also child processes. HOT 4
- 12.0.0 release
- cancellationToken doesn't work with createNoWindow! HOT 3
- Cancel child processes by default
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-exec.