Skip to content

Commit

Permalink
CI Check
Browse files Browse the repository at this point in the history
  • Loading branch information
pastuxso committed Aug 20, 2024
1 parent 4205bed commit d4dc224
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
40 changes: 19 additions & 21 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,28 +356,26 @@ export class RunmeExtension {
context.subscriptions.push(new CloudAuthProvider(context))
}

kernel
.runProgram('echo $0')
.then(({ output }) => {
const supportedShells = ['zsh', 'bash']
const isSupported = supportedShells.some((sh) => output?.includes(sh))

if (!isSupported) {
const showMore = 'Show more'
return window.showWarningMessage('Unsupported shell', showMore).then((answer) => {
if (answer === showMore) {
const dashboardUri = getFaqUrl('supported-shells')
const uri = Uri.parse(dashboardUri)
return env.openExternal(uri)
}
})
}
})
.catch((_e) => {
getLogger().warn('An error occurred while verifying the supported shell')
})

await bootFile(context)

try {
const { output } = await kernel.runProgram('echo $SHELL')
const supportedShells = ['bash', 'zsh']
const isSupported = supportedShells.some((sh) => output?.includes(sh))

if (!isSupported) {
const showMore = 'Show more'
return window.showErrorMessage('Unsupported shell', showMore).then((answer) => {
if (answer === showMore) {
const dashboardUri = getFaqUrl('supported-shells')
const uri = Uri.parse(dashboardUri)
return env.openExternal(uri)
}
})
}
} catch (_e) {
getLogger().error('An error occurred while verifying the supported shell')
}
}

protected handleMasking(kernel: Kernel, maskingIsOn: boolean): (e: NotebookUiEvent) => void {
Expand Down
5 changes: 3 additions & 2 deletions src/extension/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,13 +1114,14 @@ export class Kernel implements Disposable {
programOptions = program
} else if (typeof program === 'string') {
programOptions = {
programName: '',
programName: 'bash',
background: false,
exec: {
type: 'script',
script: program,
},
languageId: 'sh',
commandMode: CommandModeEnum().INLINE_SHELL,
storeLastOutput: false,
tty: true,
}
Expand All @@ -1141,7 +1142,7 @@ export class Kernel implements Disposable {

programSession.onDidWrite(onData)
programSession.onDidErr(onData)
await programSession.run()
programSession.run()

return new Promise<{ exitReason?: RunnerExitReason; code?: number | void; output?: string }>(
(resolve, reject) => {
Expand Down

0 comments on commit d4dc224

Please sign in to comment.