mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 03:12:16 +08:00 
			
		
		
		
	Merge pull request #2339 from daxgames/fix_global_vars_vscode_err
1.3.16-pre: 1.3.15 Fixes
This commit is contained in:
		@@ -1,5 +1,9 @@
 | 
			
		||||
# Change Log
 | 
			
		||||
 | 
			
		||||
## 1.3.16-pre
 | 
			
		||||
 | 
			
		||||
* fix vscode terminal errors when setting cmder fast_init=1 outside cmder [#2339](https://github.com/cmderdev/cmder/pull/2339)
 | 
			
		||||
 | 
			
		||||
## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26)
 | 
			
		||||
 | 
			
		||||
* Fixes #2247, fixes #2254 [#2265](https://github.com/cmderdev/cmder/pull/2265)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								vendor/bin/vscode_init.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/bin/vscode_init.cmd
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,26 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
:: Find root dir
 | 
			
		||||
 | 
			
		||||
if not defined CMDER_ROOT (
 | 
			
		||||
    for /f "delims=" %%i in ("%~dp0\..\..") do (
 | 
			
		||||
        set "cmder_root=%%~fi"
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined cmder_user_bin (
 | 
			
		||||
    set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd
 | 
			
		||||
) else (
 | 
			
		||||
    set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if not exist "%CMDER_VSCODE_INIT_ARGS%" (
 | 
			
		||||
    echo Creating initial "%CMDER_VSCODE_INIT_ARGS%"...
 | 
			
		||||
    copy "%CMDER_ROOT%\vendor\bin\vscode_init_args.cmd.default" "%CMDER_VSCODE_INIT_ARGS%"
 | 
			
		||||
) else (
 | 
			
		||||
    call "%CMDER_VSCODE_INIT_ARGS%"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
IF [%1] == [] (
 | 
			
		||||
    REM -- manually opened console (Ctrl + Shift + `) --
 | 
			
		||||
    CALL "%~dp0..\init.bat"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										58
									
								
								vendor/bin/vscode_init_args.cmd.default
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								vendor/bin/vscode_init_args.cmd.default
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
:: Below are the default Cmder session settings:
 | 
			
		||||
::
 | 
			
		||||
:: See "%CMDER_ROOT%\README.md" for details on these settings.
 | 
			
		||||
::
 | 
			
		||||
:: `Cmder.exe` Arguments:
 | 
			
		||||
:: ----------------------
 | 
			
		||||
:: 
 | 
			
		||||
:: `/c [cmder_user_cfg_root]
 | 
			
		||||
:: set cmder_user_bin=[cmder_user_cfg_root]\bin
 | 
			
		||||
:: set cmder_user_config=[cmder_user_cfg_root]\config
 | 
			
		||||
::
 | 
			
		||||
:: `init.bat` Arguments
 | 
			
		||||
:: --------------------
 | 
			
		||||
::
 | 
			
		||||
:: `/d`
 | 
			
		||||
:: debug_output=0
 | 
			
		||||
::
 | 
			
		||||
:: `/v`
 | 
			
		||||
:: verbose_output=0
 | 
			
		||||
::
 | 
			
		||||
:: `/f`
 | 
			
		||||
:: fast_init=0
 | 
			
		||||
::
 | 
			
		||||
:: `/nix_tools`
 | 
			
		||||
:: nix_tools=1
 | 
			
		||||
::
 | 
			
		||||
:: `/t`
 | 
			
		||||
:: time_init=0
 | 
			
		||||
::
 | 
			
		||||
:: `/max_depth`
 | 
			
		||||
:: max_depth=1
 | 
			
		||||
::
 | 
			
		||||
:: `/user_aliases`
 | 
			
		||||
:: user_aliases=
 | 
			
		||||
::
 | 
			
		||||
:: `/git_install_root`
 | 
			
		||||
:: GIT_INSTALL_ROOT=
 | 
			
		||||
::
 | 
			
		||||
:: `/home`
 | 
			
		||||
:: HOME=
 | 
			
		||||
::
 | 
			
		||||
:: `/svn_ssh`
 | 
			
		||||
:: SVN_SSH=
 | 
			
		||||
 | 
			
		||||
echo Applying Cmder VSCode settings from '%~0'...
 | 
			
		||||
 | 
			
		||||
if defined CMDER_CONFIGURED (
 | 
			
		||||
    :: Set Cmder settings here for when VSCode is launched inside Cmder.
 | 
			
		||||
    set verbose_output=1
 | 
			
		||||
) else (
 | 
			
		||||
    :: Set Cmder settings here for when VSCode is launched from outside Cmder.
 | 
			
		||||
    set verbose_output=1
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:: Set all required Cmder VSCode terminal environment settings above this line.
 | 
			
		||||
echo Applying Cmder VSCode settings is complete!
 | 
			
		||||
							
								
								
									
										27
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							@@ -166,10 +166,14 @@ if "%CMDER_CLINK%" == "1" (
 | 
			
		||||
  %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if "%CMDER_CONFIGURED%" == "1" (
 | 
			
		||||
  echo Cmder is already configured, skipping Cmder Init!
 | 
			
		||||
if "%CMDER_CONFIGURED%" GTR "1" (
 | 
			
		||||
  %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!"
 | 
			
		||||
 | 
			
		||||
  goto CMDER_CONFIGURED
 | 
			
		||||
  goto USER_ALIASES
 | 
			
		||||
) else if "%CMDER_CONFIGURED%" == "1" (
 | 
			
		||||
  %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!"
 | 
			
		||||
 | 
			
		||||
  goto USER_CONFIG_START
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:: Prepare for git-for-windows
 | 
			
		||||
@@ -204,10 +208,10 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
 | 
			
		||||
    %lib_git% is_git_shim "%%~dpF"
 | 
			
		||||
    %lib_git% get_user_git_version
 | 
			
		||||
    %lib_git% compare_git_versions
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if defined GIT_INSTALL_ROOT (
 | 
			
		||||
    goto :FOUND_GIT
 | 
			
		||||
    if defined GIT_INSTALL_ROOT (
 | 
			
		||||
        goto :FOUND_GIT
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:: our last hope: our own git...
 | 
			
		||||
@@ -233,10 +237,10 @@ goto :CONFIGURE_GIT
 | 
			
		||||
:: Add git to the path
 | 
			
		||||
rem add the unix commands at the end to not shadow windows commands like more
 | 
			
		||||
if %nix_tools% equ 1 (
 | 
			
		||||
    %lib_console% debug_output init.bat "Preferring Windows commands"
 | 
			
		||||
    %lib_console% verbose_output "Preferring Windows commands"
 | 
			
		||||
    set "path_position=append"
 | 
			
		||||
) else (
 | 
			
		||||
    %lib_console% debug_output init.bat "Preferring *nix commands"
 | 
			
		||||
    %lib_console% verbose_output "Preferring *nix commands"
 | 
			
		||||
    set "path_position="
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -294,6 +298,7 @@ if defined CMDER_USER_CONFIG (
 | 
			
		||||
  %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
:USER_ALIASES
 | 
			
		||||
:: Allows user to override default aliases store using profile.d
 | 
			
		||||
:: scripts run above by setting the 'aliases' env variable.
 | 
			
		||||
::
 | 
			
		||||
@@ -338,6 +343,8 @@ if "%CMDER_ALIASES%" == "1" (
 | 
			
		||||
:: Add aliases to the environment
 | 
			
		||||
call "%user_aliases%"
 | 
			
		||||
 | 
			
		||||
if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED
 | 
			
		||||
 | 
			
		||||
:: See vendor\git-for-windows\README.portable for why we do this
 | 
			
		||||
:: Basically we need to execute this post-install.bat because we are
 | 
			
		||||
:: manually extracting the archive rather than executing the 7z sfx
 | 
			
		||||
@@ -363,7 +370,7 @@ if defined CMDER_USER_CONFIG (
 | 
			
		||||
  set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
  if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
 | 
			
		||||
      REM Create this file and place your own command in there
 | 
			
		||||
      %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd
 | 
			
		||||
      %lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
      call "%CMDER_USER_CONFIG%\user_profile.cmd"
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
@@ -389,7 +396,7 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
 | 
			
		||||
set initialConfig=
 | 
			
		||||
 | 
			
		||||
:CMDER_CONFIGURED
 | 
			
		||||
set CMDER_CONFIGURED=1
 | 
			
		||||
if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
 | 
			
		||||
 | 
			
		||||
set CMDER_INIT_END=%time%
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/lib/lib_console.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/lib/lib_console.cmd
									
									
									
									
										vendored
									
									
								
							@@ -1,10 +1,10 @@
 | 
			
		||||
@echo off
 | 
			
		||||
 | 
			
		||||
if "%fast_init%" == "1" exit /b
 | 
			
		||||
 | 
			
		||||
call "%~dp0lib_base.cmd"
 | 
			
		||||
set lib_console=call "%~dp0lib_console.cmd"
 | 
			
		||||
 | 
			
		||||
if "%fast_init%" == "1" exit /b
 | 
			
		||||
 | 
			
		||||
if "%~1" == "/h" (
 | 
			
		||||
    %lib_base% help "%~0"
 | 
			
		||||
) else if "%1" neq "" (
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							@@ -32,6 +32,7 @@ exit /b
 | 
			
		||||
:::options:
 | 
			
		||||
:::
 | 
			
		||||
:::  append     <in> Append to the path env variable rather than pre-pend.
 | 
			
		||||
::B
 | 
			
		||||
:::
 | 
			
		||||
:::output:
 | 
			
		||||
:::
 | 
			
		||||
@@ -168,7 +169,8 @@ exit /b
 | 
			
		||||
        set "position="
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
 | 
			
		||||
    dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
 | 
			
		||||
 | 
			
		||||
    if "%ERRORLEVEL%" == "0" (
 | 
			
		||||
        set "add_to_path=%add_path%"
 | 
			
		||||
    ) else (
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/profile.ps1
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/profile.ps1
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
# Init Script for PowerShell
 | 
			
		||||
# Init Script for PowerShell
 | 
			
		||||
# Created as part of cmder project
 | 
			
		||||
 | 
			
		||||
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user