Skip to content

Commit 8c0109d

Browse files
Add debug mode to PBAbstractProcess and make it reflect the state of the application debugMode.
1 parent d5d7237 commit 8c0109d

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

src/PythonBridge-Pharo/PBPharoPipenvProcess.class.st

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,20 @@ PBPharoPipenvProcess >> process [
103103

104104
{ #category : #private }
105105
PBPharoPipenvProcess >> processArguments [
106-
^ {
107-
'run'.
108-
'python'. self pythonMainFile fullName.
109-
'--port'. self settings pythonSocketAddress port asString .
110-
'--pharo'. self settings pharoSocketAddress port asString .
111-
'--method'. PBPlatform current messageBrokerStrategy pythonMethodArg.
112-
"'--log'"}
106+
| args |
107+
args := OrderedCollection new.
108+
args
109+
add: 'run';
110+
add: 'python';
111+
add: self pythonMainFile fullName;
112+
add: '--port';
113+
add: self settings pythonSocketAddress port asString;
114+
add: '--pharo';
115+
add: self settings pharoSocketAddress port asString;
116+
add: '--method';
117+
add: PBPlatform current messageBrokerStrategy pythonMethodArg.
118+
self debugMode ifTrue: [ args add: '--log' ].
119+
^ args
113120
]
114121

115122
{ #category : #initialization }

src/PythonBridge/PBAbstractProcess.class.st

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Class {
33
#superclass : #Object,
44
#instVars : [
55
'pythonMainFile',
6+
'debugMode',
67
'settings',
78
'workingDirectory'
89
],
@@ -13,7 +14,7 @@ Class {
1314
PBAbstractProcess class >> application: application [
1415
^ self
1516
settings: application settings
16-
workingDirectory: (PBPlatform current folderForApplication: application)
17+
application: application
1718
]
1819

1920
{ #category : #accessing }
@@ -23,7 +24,10 @@ PBAbstractProcess class >> platform [
2324

2425
{ #category : #accessing }
2526
PBAbstractProcess class >> settings: settings application: application [
26-
^ self settings: settings workingDirectory: (PBPlatform current folderForApplication: application)
27+
^ self
28+
settings: settings
29+
workingDirectory: (PBPlatform current folderForApplication: application)
30+
debugMode: application class debugMode
2731
]
2832

2933
{ #category : #accessing }
@@ -34,11 +38,30 @@ PBAbstractProcess class >> settings: settings workingDirectory: fileRef [
3438
yourself
3539
]
3640

41+
{ #category : #accessing }
42+
PBAbstractProcess class >> settings: settings workingDirectory: fileRef debugMode: flag [
43+
^ self new
44+
settings: settings;
45+
workingDirectory: fileRef;
46+
debugMode: flag;
47+
yourself
48+
]
49+
3750
{ #category : #hooks }
3851
PBAbstractProcess class >> workingDirectory [
3952
^ self platform folderForApplication: PBApplication
4053
]
4154

55+
{ #category : #accessing }
56+
PBAbstractProcess >> debugMode [
57+
^ debugMode
58+
]
59+
60+
{ #category : #accessing }
61+
PBAbstractProcess >> debugMode: anObject [
62+
debugMode := anObject
63+
]
64+
4265
{ #category : #accessing }
4366
PBAbstractProcess >> errorMessage [
4467
self subclassResponsibility

0 commit comments

Comments
 (0)