do not allow restart on windows
This commit is contained in:
		
							parent
							
								
									938e1bddd3
								
							
						
					
					
						commit
						7c7e5de091
					
				
					 10 changed files with 83 additions and 11 deletions
				
			
		|  | @ -23,7 +23,8 @@ import filepaths | |||
| DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA" | ||||
| PASSWORD_LENGTH = 25 | ||||
| ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net' | ||||
| ONIONR_VERSION = '1.1.0' | ||||
| ONIONR_VERSION = '2.0.0' | ||||
| ONIONR_VERSION_CODENAME = 'Genesis' | ||||
| ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION) | ||||
| API_VERSION = '0' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you. | ||||
| MIN_PY_VERSION = 7 # min version of 7 so we can take advantage of non-cyclic type hints | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ Misc client API endpoints too small to need their own file and that need access | |||
| """ | ||||
| import os | ||||
| import subprocess | ||||
| import platform | ||||
| 
 | ||||
| from flask import Response, Blueprint, request, send_from_directory, abort | ||||
| from gevent import spawn | ||||
|  | @ -130,4 +131,8 @@ class PrivateEndpoints: | |||
|         @private_endpoints_bp.route('/setonboarding', methods=['POST']) | ||||
|         def set_onboarding(): | ||||
|             return Response(config.onboarding.set_config_from_onboarding(request.get_json())) | ||||
|          | ||||
|         @private_endpoints_bp.route('/os') | ||||
|         def get_os_system(): | ||||
|             return Response(platform.system().lower()) | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,6 +36,10 @@ SCRIPT_NAME = os.path.dirname(os.path.realpath( | |||
| 
 | ||||
| def restart(): | ||||
|     """Tell the Onionr daemon to restart.""" | ||||
|     if platform.system() == 'Windows': | ||||
|         logger.warn('Cannot restart Onionr on Windows. Run stop and manually restart.', terminal=True) | ||||
|         return | ||||
| 
 | ||||
|     logger.info('Restarting Onionr', terminal=True) | ||||
| 
 | ||||
|     # On platforms where we can, fork out to prevent locking | ||||
|  | @ -44,8 +48,7 @@ def restart(): | |||
|         if pid != 0: | ||||
|             return | ||||
|     except (AttributeError, OSError): | ||||
|         if platform.platform() != 'Windows': | ||||
|             logger.warn('Could not fork on restart') | ||||
|         logger.warn('Could not fork on restart') | ||||
| 
 | ||||
|     daemonlaunch.kill_daemon() | ||||
|     while localcommand.local_command('ping', maxWait=8) == 'pong!': | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ from onionrutils import epoch | |||
| from . import uicheck, inserttest, stresstest | ||||
| from . import ownnode | ||||
| from .webpasstest import webpass_test | ||||
| from .osver import test_os_ver_endpoint | ||||
| """ | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|  | @ -30,7 +31,8 @@ RUN_TESTS = [uicheck.check_ui, | |||
|              ownnode.test_tor_adder, | ||||
|              ownnode.test_own_node, | ||||
|              stresstest.stress_test_block_insert, | ||||
|              webpass_test | ||||
|              webpass_test, | ||||
|              test_os_ver_endpoint | ||||
|              ] | ||||
| 
 | ||||
| SUCCESS_FILE = os.path.dirname(os.path.realpath(__file__)) + '/../../tests/runtime-result.txt' | ||||
|  |  | |||
							
								
								
									
										8
									
								
								src/runtests/osver.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/runtests/osver.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| import platform | ||||
| 
 | ||||
| from onionrutils import localcommand | ||||
| 
 | ||||
| 
 | ||||
| def test_os_ver_endpoint(test_manager): | ||||
|     if localcommand.local_command('os') != platform.system().lower(): | ||||
|         raise ValueError('could not get proper os platform from endpoint /os') | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue