mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Add error checking to nvm_tree_contains_path
This commit is contained in:
		
							
								
								
									
										6
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -58,6 +58,12 @@ nvm_tree_contains_path() { | ||||
|   tree="$1" | ||||
|   local node_path | ||||
|   node_path="$2" | ||||
|  | ||||
|   if [ "@$tree@" = "@@" ] || [ "@$node_path@" = "@@" ]; then | ||||
|     >&2 echo "both the tree and the node path are required" | ||||
|     return 2 | ||||
|   fi | ||||
|  | ||||
|   local pathdir | ||||
|   pathdir=$(dirname "$node_path") | ||||
|   while [ "$pathdir" != "" ] && [ "$pathdir" != "." ] && [ "$pathdir" != "/" ] && [ "$pathdir" != "$tree" ]; do | ||||
|   | ||||
		Reference in New Issue
	
	Block a user