@@ -9,7 +9,7 @@ const extend = require('util')._extend // eslint-disable-line
99const win = process . platform === 'win32'
1010const logWithPrefix = require ( './util' ) . logWithPrefix
1111
12- //! after editing file dont forget run "npm test" and
12+ //! after editing file don't forget run "npm test" and
1313//! change tests for this file if needed
1414
1515// ? may be some addition info in silly and verbose levels
@@ -33,8 +33,8 @@ function colorizeOutput (color, string) {
3333}
3434
3535//! on windows debug running with locale cmd (e. g. chcp 866) encoding
36- // to avoid that uncoment next lines
37- // locale encdoings couse issues. See run func for more info
36+ // to avoid that uncomment next lines
37+ // locale encodings cause issues. See run func for more info
3838// this lines only for testing
3939// win ? cp.execSync("chcp 65001") : null
4040// log.level = "silly";
@@ -46,7 +46,7 @@ class PythonFinder {
4646 /**
4747 *
4848 * @param {string } configPython force setted from terminal or npm config python path
49- * @param {(err:Error, found:string) => void } callback succsed /error callback from where result
49+ * @param {(err:Error, found:string) => void } callback succeed /error callback from where result
5050 * is available
5151 */
5252 constructor ( configPython , callback ) {
@@ -109,7 +109,7 @@ class PythonFinder {
109109 }
110110
111111 /**
112- * Getting list of checks which should be cheked
112+ * Getting list of checks which should be checked
113113 *
114114 * @private
115115 * @returns {check[] }
@@ -256,7 +256,7 @@ class PythonFinder {
256256 * @argument {check[]} checks
257257 */
258258 async runChecks ( checks ) {
259- // using this flag becouse Fail is happen when ALL checks fail
259+ // using this flag because Fail is happen when ALL checks fail
260260 let fail = true
261261
262262 for ( const check of checks ) {
@@ -319,7 +319,7 @@ class PythonFinder {
319319 let args = this . argsExecutable
320320 let shell = false
321321 if ( this . win ) {
322- // Arguments have to be manually quoted to avoid bugs with spaces in pathes
322+ // Arguments have to be manually quoted to avoid bugs with spaces in paths
323323 exec = `"${ exec } "`
324324 args = args . map ( ( a ) => `"${ a } "` )
325325 shell = true
@@ -354,8 +354,8 @@ class PythonFinder {
354354
355355 /**
356356 *
357- * Check if a getted path is correct and
358- * Python executable hase the correct version to use.
357+ * Check if a gotten path is correct and
358+ * Python executable has the correct version to use.
359359 *
360360 * @private
361361 * @argument {string} execPath path to check
@@ -370,7 +370,7 @@ class PythonFinder {
370370 this . run ( execPath , this . argsVersion , false )
371371 . then ( ( ver ) => {
372372 // ? may be better code for version check
373- // ? may be move log messgaes to catchError func
373+ // ? may be move log messages to catchError func
374374 const range = new semver . Range ( this . semverRange )
375375 let valid = false
376376
@@ -398,7 +398,7 @@ class PythonFinder {
398398 colorizeOutput ( RED , 'THIS VERSION OF PYTHON IS NOT SUPPORTED' )
399399 )
400400 // object with error passed for conveniences
401- // (becouse we may want to pass also stderr or some additional stuff )
401+ // (because we may also want to pass stderr or other variables )
402402 // eslint-disable-next-line prefer-promise-reject-errors
403403 reject ( {
404404 err : new Error ( `Found unsupported Python version ${ ver } ` )
@@ -443,27 +443,26 @@ class PythonFinder {
443443 )
444444 this . log . silly ( 'execFile: opts = ' , JSON . stringify ( opts , null , 2 ) )
445445
446- //* prosible outcomes with error messages on windows (err.message, error.stack?, stderr)
446+ //* possible outcomes with error messages on Windows (err.message, error.stack?, stderr)
447447 // issue of encoding (garbage in terminal ) when 866 or any other locale code
448448 // page is setted
449449 // possible solutions:
450- // 1. let it be as it is and just warn user that it should use utf8
451- // (already done in this.catchErros 's info statement)
452- // 2. somehow determine user's terminal encdoing and use utils.TextDecoder
453- // with getting raw buffer from execFile.
454- // Requires to correct error.message becouse garbage persists there
455- // 3. Forse user's terminal to use utf8 encoding via e.g. run "chcp 65001". May broke some user's programs
456- // 4. use "cmd" command with flag "/U" and "/C" (for more informatiom run "help cmd")
450+ // 1. leave it as is and just warn the user that it should use utf8
451+ // (already done in this.catchError 's info statement)
452+ // 2. somehow determine the user's terminal encoding and use utils.TextDecoder
453+ // with the raw buffer from execFile.
454+ // Requires to correct error.message because garbage persists there
455+ // 3. Force the user's terminal to use utf8 encoding via e.g. run "chcp 65001". May break user's programs
456+ // 4. use "cmd" command with flag "/U" and "/C" (for more information run "help cmd")
457457 // which "Causes the output of
458458 // internal commands ... to be Unicode" (utf16le)
459459 //* note: find-python-script.py already send output in utf8 then may become necessary
460460 //* to reencode string with Buffer.from(stderr).toString() or something
461461 //* similar (if needed)
462- // for this solution all execFile call should look like execFile("cmd /U /C", [command to run, arg1, arg2, ...])
463- //* all pathes/commands and each argument must be in quotes becouse if they have
464- //* spaces inside they will broke everything
462+ // for this solution all execFile call should look like execFile("cmd", ["/U", "/C", command to run, arg1, arg2, ...])
463+ //* all paths/commands and each argument must be in quotes if they contain spaces
465464
466- //* assume that user use utf8 compatible terminal
465+ //* assume we have a utf8 compatible terminal
467466 this . execFile ( exec , args , opts , execFileCallback . bind ( this ) )
468467
469468 /**
@@ -478,13 +477,13 @@ class PythonFinder {
478477 ( err && err . stack ) || err
479478 )
480479
481- // executed script shouldn't pass anythong to stderr if successful
480+ // executed script shouldn't pass anything to stderr if successful
482481 if ( err || stderr ) {
483482 reject ( { err : err || null , stderr : stderr || null } )
484483 } else {
485- // trim() function remove string endings that break string comparsion
486- const stdoutTrimed = stdout . trim ( )
487- resolve ( stdoutTrimed )
484+ // trim() function removes string endings that would break string comparison
485+ const stdoutTrimmed = stdout . trim ( )
486+ resolve ( stdoutTrimmed )
488487 }
489488 }
490489 } . bind ( this )
@@ -509,7 +508,7 @@ class PythonFinder {
509508 // array of error codes (type of errors) that we handling
510509 const catchedErrorsCods = [ 'ENOENT' , 9009 ]
511510
512- // dont know type of terminal errors
511+ // don't know type of terminal errors
513512 // @ts -ignore
514513 if ( catchedErrorsCods . includes ( err ? err . code : undefined ) ) {
515514 // @ts -ignore
@@ -596,7 +595,7 @@ class PythonFinder {
596595 process . nextTick (
597596 this . callback . bind (
598597 null ,
599- // if changing error message dont forget also change it test file too
598+ // if changing error message don't forget also change it test file too
600599 new Error ( 'Could not find any Python installation to use' )
601600 )
602601 )
@@ -606,7 +605,7 @@ class PythonFinder {
606605/**
607606 *
608607 * @param {string } configPython force setted from terminal or npm config python path
609- * @param {(err:Error, found:string)=> void } callback succsed /error callback from where result
608+ * @param {(err:Error, found:string)=> void } callback succeed /error callback from where result
610609 * is available
611610 */
612611function findPython ( configPython , callback ) {
0 commit comments