Skip to content

Commit

Permalink
feat: exiting kin while it's running
Browse files Browse the repository at this point in the history
  • Loading branch information
pacifiquem committed Mar 3, 2024
1 parent 3469673 commit 9242e8b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/runtime/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
unlinkSync as deleteFileSync,
} from 'fs';
import path from 'path';
import { Runtime } from 'inspector';
import { NumericLiteral } from '../parser/ast';

export function createGlobalEnv(filename: string): Environment {
const env = new Environment();
Expand Down Expand Up @@ -88,6 +86,15 @@ export function createGlobalEnv(filename: string): Environment {
true,
);

env.declareVar(
'hagarara',
MK_NATIVE_FN((args) => {
const exit_code = (args[0] as NumberVal).value;
process.exit(exit_code);
}),
true,
);

// Kin mathematics utility functions
env.declareVar(
'KIN_IMIBARE',
Expand Down

0 comments on commit 9242e8b

Please sign in to comment.