7

My VS Code integrated terminal is only toggling up for a second then disappearing with the command Ctrl+`(Tried to change it - still not working :)), showing the Integrated terminal exited with code 1 error.

Any ideas for fixing it?

Peter Zhisov
  • 71
  • 1
  • 1
  • 3

7 Answers7

2

I had the same problem on Windows 10. The problem was that I had VSCode running in compatibility mode (Windows 8). If that is that case for you, just uncheck "Run this program in compatibility mode for" checkbox in Compatibility tab of the VSCode properties, click in OK and restart VSCode.

1

I had the same problem just a few minutes ago, in my case this error was a path consequence, my windows user folder has an accent (c:/users/josé /..) , so, just try to move your project into another folder, like "C:/projects".

José
  • 11
  • 1
0

Current Solution is using a none-English named Folder as project Folder.

Here is my research:

default value "terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\cmd.exe"

Following is the debug info in VScode:

terminalInstance.ts:55 Integrated terminal exited with code 1

(anonymous function) @ terminalInstance.ts:55

emitTwo @ events.js:100

emit @ events.js:185

ChildProcess._handle.onexit @ internal/child_process.js:204

Following is debug info in Atom:

C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\src\task.js:52

Unable to start terminal process. Win32 error code: 267 Error: Unable to start terminal process. Win32 error code: 267 at Error (native) at Server. (C:\Users\mzvast.atom\packages\platformio-ide-terminal\node_modules\pty.js\lib\pty_win.js:67:9) at emitOne (events.js:90:13) at Server.emit (events.js:182:7) at Pipe.onconnection (net.js:1439:8) (anonymous function) @C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\src\task.js:52 (anonymous function) @C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\src\task.js:126 module.exports.Emitter.simpleDispatch @ C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\node_modules\event-kit\lib\emitter.…:25 module.exports.Emitter.emit @ C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\node_modules\event-kit\lib\emitter.…:125 (anonymous function) @ C:\Users\mzvast\AppData\Local\atom\app-1.9.1\resources\app.asar\src\task.js:78emitTwo @ events.js:100 emit @ events.js:185 handleMessage @ internal/child_process.js:718 channel.onread @ internal/child_process.js:444

The win32 error code 267 seem to be,according to microsoft:

ERROR_DIRECTORY
267 (0x10B)
The directory name is invalid.
Nick Wong
  • 56
  • 4
0

Close vscode, create a new folder somewhere on your pc, but not inside the directory which was previously opened with vscode. Open this new directory with vscode and then try opening your terminal. If your terminal opens, then the problem was with your previous directory. This happened with me, the directory didn't exist but was listed in my file explorer. Now, whenever your start your terminal, it will start with the same directory which is opened in your vscode. In this case, the directory didn't exist or had same issues, hence the problem.

0

Important!! First, try this method.

  1. Create a dummy directory anywhere on your PC, except the present directory that is open in your Explorer.
  2. Save any thing that is open.
  3. Open the dummy directory that you created File > Open a folder > 'Your Folder'
  4. Try opening integrated terminal using View > Terminal.

If this works, then there's a problem with the directory. Create a new directory and migrate all files to that directory.
If not, then try changing the settings listed here in other answers or check whether VSCode is running in Compatibility Mode or not.

-1

I had the same Exit code 1.. And found the solution as below.. Open the settings on Visual Studio Code and click Edit in settings.json as marked:

Edit in settings.json

Change the terminal.integrated.shell.windows settings on the red marked line as you see: Settings.json

  • 3
    https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question This is for questions, but it applies to answers too. – HolyBlackCat Oct 26 '20 at 21:46
-2

just uncheck "Run this program in compatibility mode for" checkbox in Compatibility tab of the VSCode properties, click in OK and apply and restart VSCode.

Nasr
  • 1