0

I am running Cygwin terminal in Visual Studio Code (2019), and I tried to run hello.sh and hello.py file, but nothing gets printed out in the terminal. No error message either. I also tried to open a Cygwin terminal outside of Visual Studio, nothing gets printed out either.

However, I created the same files from Pycharm in a venv directory, and copied the files into my Cygwin directory -- it worked.

code in hello.py file:

print("hello world")

code in hello.sh file:

echo hello world

I run these files with the same commands in all of the aforementioned terminals:

./hello.sh
python hello.py

Output when I use hello.py and hello.sh files generated and copied from Pycharm:

hello world

Otherwise nothing goes on when run these two files from Cygwin.

I wonder how this happened and how to generate .py files and .sh that will work directly in VS Studio.

I have seen other threads mentioning a "command not found" error when running .sh files. It is not my case, since no error gets printed out.

Thanks!

4
  • Where VS is looking for the program to execute ? I doubt it is Cygwin aware and knows that needs to run the cygwin version of bash or python Commented Dec 7, 2020 at 18:31
  • Maybe the first step is to run something like diff hello.py pycharm/hello.py Commented Dec 7, 2020 at 18:34
  • @matzeri Hi, I have configured VS code to use Cygwin as the integrated terminal. Commented Dec 8, 2020 at 12:50
  • @Bec Zhao -How are things going? Just checking in to see if the information provided was helpful. Commented Dec 10, 2020 at 8:00

1 Answer 1

1

According to your description, I tested this process on my computer, and it is recommended that you could refer to the following:

  1. Please ensure that the download and installation of "Cygwin Terminal" is correct.

  2. Before using this terminal to execute a file, please go to the parent folder where the file is located.

    1). Execute the "hello.sh" file in the "Cygwin" terminal outside of VSCode:

    enter image description here

    2). Use the "Cygwin" terminal to execute the "hello.sh" file in VSCode:

    enter image description here

    3). Use the "Cygwin" terminal in VSCode to execute the "hello.py" file:

    enter image description here

In addition, in order to use the "Cygwin" terminal in VSCode, I used the following settings in "settings.json":

"terminal.integrated.shell.windows": "...:/cygwin64/bin/bash.exe",

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.