Skip to content

Commit

Permalink
lib: fixed spelling errors in comments
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Clauss <[email protected]>
  • Loading branch information
owl-from-hogvarts and cclauss committed Jan 29, 2021
1 parent 5ed6311 commit 05a92de
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions lib/find-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class PythonFinder {
colorizeOutput(RED, 'THIS VERSION OF PYTHON IS NOT SUPPORTED')
)
// object with error passed for conveniences
// (becouse we may want to pass also stderr or some additional stuff)
// (because we may also want to pass stderr or other variables)
// eslint-disable-next-line prefer-promise-reject-errors
reject({
err: new Error(`Found unsupported Python version ${ver}`)
Expand Down Expand Up @@ -435,27 +435,26 @@ class PythonFinder {
)
this.log.silly('execFile: opts = ', JSON.stringify(opts, null, 2))

//* prosible outcomes with error messages on windows (err.message, error.stack?, stderr)
//* possible outcomes with error messages on Windows (err.message, error.stack?, stderr)
// issue of encoding (garbage in terminal ) when 866 or any other locale code
// page is setted
// possible solutions:
// 1. let it be as it is and just warn user that it should use utf8
// (already done in this.catchErros's info statement)
// 2. somehow determine user's terminal encdoing and use utils.TextDecoder
// with getting raw buffer from execFile.
// Requires to correct error.message becouse garbage persists there
// 3. Forse user's terminal to use utf8 encoding via e.g. run "chcp 65001". May broke some user's programs
// 1. leave it as is and just warn the user that it should use utf8
// (already done in this.catchError's info statement)
// 2. somehow determine the user's terminal encoding and use utils.TextDecoder
// with the raw buffer from execFile.
// Requires to correct error.message because garbage persists there
// 3. Force the user's terminal to use utf8 encoding via e.g. run "chcp 65001". May break user's programs
// 4. use "cmd" command with flag "/U" and "/C" (for more informatiom run "help cmd")
// which "Causes the output of
// internal commands ... to be Unicode" (utf16le)
//* note: find-python-script.py already send output in utf8 then may become necessary
//* to reencode string with Buffer.from(stderr).toString() or something
//* similar (if needed)
// for this solution all execFile call should look like execFile("cmd /U /C", [command to run, arg1, arg2, ...])
//* all pathes/commands and each argument must be in quotes becouse if they have
//* spaces inside they will broke everything
// for this solution all execFile call should look like execFile("cmd", ["/U", "/C", command to run, arg1, arg2, ...])
//* all paths/commands and each argument must be in quotes if they contain spaces

//* assume that user use utf8 compatible terminal
//* assume we have a utf8 compatible terminal
this.execFile(exec, args, opts, execFileCallback.bind(this))

/**
Expand All @@ -474,7 +473,7 @@ class PythonFinder {
if (err || stderr) {
reject({ err: err || null, stderr: stderr || null })
} else {
// trim() function remove string endings that break string comparsion
// trim() function removes string endings that would break string comparsion
const stdoutTrimed = stdout.trim()
resolve(stdoutTrimed)
}
Expand Down

0 comments on commit 05a92de

Please sign in to comment.