File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed
python/pythonmonkey/builtin_modules Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ class Console {
5454 this . log = ( ...args ) => this . #writeToStdout( this . #formatToStr( ...args ) ) ;
5555 this . debug = ( ...args ) => this . #writeToStdout( this . #formatToStr( ...args ) ) ;
5656 this . info = ( ...args ) => this . #writeToStdout( this . #formatToStr( ...args ) ) ;
57- this . warn = ( ...args ) => this . #writeToStdout ( this . #formatToStr( ...args ) ) ;
58- this . error = ( ...args ) => this . #writeToStdout ( this . #formatToStr( ...args ) ) ;
57+ this . warn = ( ...args ) => this . #writeToStderr ( this . #formatToStr( ...args ) ) ;
58+ this . error = ( ...args ) => this . #writeToStderr ( this . #formatToStr( ...args ) ) ;
5959 }
6060
6161 /**
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # @file console-stdio.bash
4+ # A peter-jr test which ensures that the console object uses the right file descriptors.
5+ #
6+ # @author Wes Garland, [email protected] 7+ # @date July 2023
8+
9+ set -u
10+ set -o pipefail
11+
12+ panic ()
13+ {
14+ echo " FAIL: $* " >&2
15+ exit 2
16+ }
17+
18+ cd ` dirname " $0 " ` || panic " could not change to test directory"
19+
20+ " ${PMJS:- ../ ../ pmjs} " \
21+ -e ' console.log("stdout")' \
22+ -e ' console.debug("stdout")' \
23+ -e ' console.info("stdout")' \
24+ < /dev/null \
25+ | grep -c ' ^stdout$' \
26+ | while read qty
27+ do
28+ echo " stdout: $qty "
29+ [ " $qty " != " 3" ] && panic qty should not be $qty
30+ break
31+ done || exit $?
32+
33+ " ${PMJS:- ../ ../ pmjs} " \
34+ -e ' console.error("stderr")' \
35+ -e ' console.warn("stderr")' \
36+ < /dev/null 2>&1 \
37+ | grep -c ' ^stderr$' \
38+ | while read qty
39+ do
40+ echo " stderr: $qty "
41+ [ " $qty " != " 2" ] && panic qty should not be $qty
42+ break
43+ done || exit $?
44+
45+ echo " done"
You can’t perform that action at this time.
0 commit comments