Some portability and code change

Signed-off-by: Pablo Lezaeta <prflr88@gmail.com>
Added a tryexec option"

Signed-off-by: Pablo Lezaeta <prflr88@gmail.com>