make sure we check for write access before starting the install, and add correct exit code
diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py
index 6e4816d..1a246c5 100644
--- a/Lib/packaging/run.py
+++ b/Lib/packaging/run.py
@@ -225,16 +225,22 @@
         if 'setup.py' in listing or 'setup.cfg' in listing:
             args.insert(1, os.getcwd())
         else:
-            logger.warning('no project to install')
-            return
+            logger.warning('No project to install.')
+            return 1
 
     target = args[1]
     # installing from a source dir or archive file?
     if os.path.isdir(target) or _is_archive_file(target):
-        install_local_project(target)
+        if install_local_project(target):
+            return 0
+        else:
+            return 1
     else:
         # download from PyPI
-        install(target)
+        if install(target):
+            return 0
+        else:
+            return 1
 
 
 @action_help(metadata_usage)