The program doesn't output anything in Windows 10 #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plan
Step 1: Update run_bash_file_from_string Function
Instead of running the script via bash directly, which is not cross-platform compatible, let's write code in
run_bash_file_from_string(s: str)
that first detects the operating system and then runs the script in the appropriate shell.Here is how it might look:
Note that I've used
os.name
to detect the operating system. According to Python's os documentation,os.name
is'nt'
for Windows, and'posix'
for Unix/Linux.The system command to execute a script in PowerShell is
'powershell.exe ScriptPath'
.Step 2: Modify Commands According to OS in main.py
The issue also suggested modifying the command according to the user's operating system. For this, we'll need to detect the OS, similar to the above step, and modify the command accordingly before passing it to the
run_bash_file_from_string(s: str)
function in src/main.py. However, this step requires additional context about the input commands and cannot be addressed in isolation without it.Considering the provided information and the analysis, the above step (Step 1) resolves the issue at hand and should provide the desired output on Windows 10.
Fixes #2