Skip to content

Commit

Permalink
support for no final
Browse files Browse the repository at this point in the history
  • Loading branch information
daretodave committed Apr 24, 2024
1 parent 78cfedb commit ed11c97
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/main/framework/runtime-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export function attach({ app, workspace }: BootstrapContext): void {

const result: Result = command.result

let finalize: boolean = true

try {
const out = (text: string, error: boolean = false): void => {
const raw = text.toString()
Expand Down Expand Up @@ -148,7 +150,17 @@ export function attach({ app, workspace }: BootstrapContext): void {
result.code = code
}

await execute(platform, workspace, runtimeTarget, command, out, finish)
const finalizeConfirm = await execute(
platform,
workspace,
runtimeTarget,
command,
out,
finish
)
if (finalizeConfirm !== undefined && finalizeConfirm === false) {
finalize = false
}
} catch (e) {
result.stream.push({
error: true,
Expand All @@ -158,8 +170,10 @@ export function attach({ app, workspace }: BootstrapContext): void {
result.code = 1
}

command.complete = true
command.error = result.code !== 0
if (finalize) {
command.complete = true
command.error = result.code !== 0
}

return command
})
Expand Down
7 changes: 6 additions & 1 deletion src/main/framework/runtime-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function execute(
command: Command,
out: (text: string, error?: boolean) => void,
finish: (code: number) => void
): Promise<void> {
): Promise<void | boolean> {
const [cmd, ...args] = command.prompt.split(' ')

// check for system commands
Expand Down Expand Up @@ -86,6 +86,11 @@ export async function execute(

const result = await Promise.resolve(exec(...args))

if (!result) {
// nothing was replied with, assume this is a run that will happen in time
return false
}

out(`${result}`)
return
}
Expand Down

0 comments on commit ed11c97

Please sign in to comment.