mirror of
				https://github.com/jart/cosmopolitan.git
				synced 2025-10-27 19:34:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			283 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			283 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| [[ -x $(whence -p nproc) ]] && {
 | |
|   command nproc && {
 | |
|     unfunction nproc
 | |
|     return
 | |
|   }
 | |
| }
 | |
| [[ -x $(which sysctl) ]] && {
 | |
|   nproc() {
 | |
|     sysctl -n hw.ncpu
 | |
|   }
 | |
|   nproc && return
 | |
| }
 | |
| # TODO other platforms
 | |
| echo nproc: no implementation found >&2
 | |
| nproc() {
 | |
|   echo 2
 | |
| }
 | |
| nproc
 | |
| # vim:ft=zsh
 |