Skip to content

Commit

Permalink
feat-fix: fix the repl being broken
Browse files Browse the repository at this point in the history
from [this situation](#718 (comment)), good job us
  • Loading branch information
Ellpeck committed Mar 14, 2024
1 parent 517dd18 commit 6ad5e6b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/flowr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Otherwise, it will start a REPL that can call these scripts and return their results repeatedly.
*/
import { log, LogLevel } from './util/log'
import type { RShellOptions } from './r-bridge'
import { RShell } from './r-bridge'
import type { OptionDefinition } from 'command-line-usage'
import commandLineUsage from 'command-line-usage'
Expand Down Expand Up @@ -90,15 +91,18 @@ setConfigFile(undefined, options['config-file'] ?? defaultConfigFile, true)

function retrieveShell(): RShell {
// we keep an active shell session to allow other parse investigations :)
return new RShell({
let opts: Partial<RShellOptions> = {
revive: 'always',
onRevive: (code, signal) => {
const signalText = signal == null ? '' : ` and signal ${signal}`
console.log(formatter.format(`R process exited with code ${code}${signalText}. Restarting...`, { color: Colors.Magenta, effect: ColorEffect.Foreground }))
console.log(italic(`If you want to exit, press either Ctrl+C twice, or enter ${bold(':quit')}`))
},
pathToRExecutable: options['r-path']
})
}
}
if(options['r-path']) {
opts = { ...opts, pathToRExecutable: options['r-path'] }
}
return new RShell(opts)
}

async function mainRepl() {
Expand Down

0 comments on commit 6ad5e6b

Please sign in to comment.