File tree Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 56
56
SOM_INTERP=BC pytest
57
57
SOM_INTERP=AST ./som.sh -cp Smalltalk TestSuite/TestHarness.som
58
58
SOM_INTERP=BC ./som.sh -cp Smalltalk TestSuite/TestHarness.som
59
+ echo "[system exit: 0] value" | SOM_INTERP=AST ./som.sh -cp Smalltalk
60
+ echo "[system exit: 0] value" | SOM_INTERP=BC ./som.sh -cp Smalltalk
59
61
60
62
- name : Full Tests
61
63
if : matrix.id != 'basic'
Original file line number Diff line number Diff line change 1
1
import os
2
2
3
+ from rlib .string_stream import decode_str
4
+
3
5
4
6
def path_split (path ):
5
7
"""
@@ -21,15 +23,15 @@ def path_split(path):
21
23
22
24
23
25
def _read_raw (answer ):
24
- buf = os .read (1 , 32 )
26
+ buf = os .read (0 , 32 )
25
27
if len (buf ) == 0 :
26
28
return answer , False
27
- if buf [- 1 ] == "\n " :
28
- return answer + buf [:- 1 ], False
29
- return answer + buf , True
29
+ if buf [- 1 ] == b "\n "[ 0 ] :
30
+ return answer + decode_str ( buf [:- 1 ]) , False
31
+ return answer + decode_str ( buf ) , True
30
32
31
33
32
- def raw_input (msg = "" ):
34
+ def raw_input (msg = b "" ):
33
35
os .write (1 , msg )
34
36
answer , cont = _read_raw ("" )
35
37
while cont :
Original file line number Diff line number Diff line change 4
4
def encode_to_bytes (str_value ):
5
5
return str_value
6
6
7
+ def decode_str (str_value ):
8
+ return str_value
9
+
7
10
except ImportError :
8
11
"NOT_RPYTHON"
9
12
@@ -20,11 +23,17 @@ class StreamError(Exception):
20
23
def encode_to_bytes (str_value ):
21
24
return str_value .encode ("utf-8" )
22
25
26
+ def decode_str (str_value ):
27
+ return str_value .decode ("utf-8" )
28
+
23
29
else :
24
30
25
31
def encode_to_bytes (str_value ):
26
32
return str_value
27
33
34
+ def decode_str (str_value ):
35
+ return str_value
36
+
28
37
29
38
class StringStream (Stream ):
30
39
def __init__ (self , string ):
Original file line number Diff line number Diff line change
1
+ from rlib .exit import Exit
1
2
from rlib .objectmodel import we_are_translated
2
3
from rlib .osext import raw_input
4
+ from som .compiler .parse_error import ParseError
3
5
from som .vm .globals import nilObject
4
6
from som .vm .symbols import symbol_for
5
7
@@ -19,7 +21,7 @@ def start(self):
19
21
while True :
20
22
try :
21
23
# Read a statement from the keyboard
22
- stmt = raw_input ("---> " )
24
+ stmt = raw_input (b "---> " )
23
25
if stmt == "quit" or stmt == "" :
24
26
return it
25
27
if stmt == "\n " :
@@ -44,6 +46,10 @@ def start(self):
44
46
shell_method = shell_class .lookup_invokable (symbol_for ("run:" ))
45
47
46
48
it = shell_method .invoke_2 (shell_object , it )
49
+ except ParseError as ex :
50
+ error_println (str (ex ))
51
+ except Exit as ex :
52
+ raise ex
47
53
except Exception as ex : # pylint: disable=broad-except
48
54
if not we_are_translated (): # this cannot be done in rpython
49
55
import traceback
You can’t perform that action at this time.
0 commit comments