Improved the detection of the executed command thanks to the path dirs