Catch mknod error type

Hi guys, at some points my program need to run the command mknod, but I have one question.

Basically I checked, if mknod face an error OR the node is already made, it return the code 1 anyway.

I would like basically to continue my program execution if the node already exists, but stop the program for any other reasons. Any idea ?

You could check whether the file exists with File.exists?, or call the underlying function directly (see C bindings) and check its return value and then ERRNO.

1 Like

Ah yes, I am stupid, I didn’t think about this xD.

Thanks