replace nonexisting os.exit by sys.exit in publish script