Handle getcwd failure

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>