# Detect crashing application in a script



## octix (Dec 18, 2009)

Hi there.

I'm trying to find a way how to determine if an app has crashed during execution(in particular ffmpeg)  or finished as supposed to.

Basically during conversion ffmpeg coredumps and messes up next steps... The echo $? will always return 0. I need to detect this kind of crashes... is there any way?

I think I need some kind of wrapper... but I cannot find anything I could use so far, I don't have much experience with this kind of problems.

Thanks.


----------



## crsd (Dec 18, 2009)

Strange. sh manpage tells:

```
If a command is terminated by a signal, its exit status is 128 plus the
     signal number.  Signal numbers are defined in the header file
     <sys/signal.h>.
```

And indeed:

```
> ./test ; echo $?
Segmentation fault (core dumped)
139
```


----------



## octix (Dec 18, 2009)

Hm... i think I did something wrong before. Yes, it gives me 139.

Thanks!


----------

