Skip to content

Commit

Permalink
Made #xspawn:env: on PTerm use â��libttyâ�� if available (added to th…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzwind committed Apr 19, 2024
1 parent c139ccf commit 5d9e9c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 8 additions & 7 deletions PTerm-Core/LibPTerm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ LibPTerm >> kill: pid signal: sig [

{ #category : #'accessing platform' }
LibPTerm >> macModuleName [
^ self moduleName
^ 'libtty.dylib'
]

{ #category : #accessing }
Expand All @@ -182,11 +182,6 @@ LibPTerm >> master [

]

{ #category : #'accessing platform' }
LibPTerm >> moduleName [
^ (FileLocator localDirectory absolutePath / 'libpterm.flib') asFileReference pathString
]

{ #category : #lib }
LibPTerm >> open: name mode: flag [
^ self ffiCall: #(int open(char* name, int flag)) module: LibC
Expand Down Expand Up @@ -252,9 +247,15 @@ LibPTerm >> stringArrayOf: anArray [
^ xarray
]

{ #category : #lib }
LibPTerm >> ttySpawn: fdm path: path argv: argv envs: envp [

^ self ffiCall: #(int tty_spawn(int fdm, const char* path, void* argv, void* envp))
]

{ #category : #'accessing platform' }
LibPTerm >> unixModuleName [
^ self moduleName
^ 'libtty.so'
]

{ #category : #lib }
Expand Down
4 changes: 3 additions & 1 deletion PTerm-Core/PTerm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ PTerm >> xspawn: argv env:envs [
xarray ifNotNil: [ xarray := xarray getHandle ].
earray ifNotNil: [ earray := earray getHandle ] ifNil: [Smalltalk os environment environ getHandle].
master := self lib master.
self spawn: (argv first) args: xarray env: earray.
[ pid := self lib ttySpawn: master path: argv first argv: xarray envs: earray ]
on: Error do: [ :err |
self spawn: argv first args: xarray env: earray ].
active := true.
Transcript show: 'Command run on process: ', pid asString; cr.
]

0 comments on commit 5d9e9c0

Please sign in to comment.