@@ -21,6 +21,7 @@ import typescript from "./typescript.js";
2121import vala from "./vala.js" ;
2222import python from "./python.js" ;
2323import rust from "./rust.js" ;
24+ import { Interrupt } from "./util.js" ;
2425
2526GObject . type_ensure ( Shumate . SimpleMap ) ;
2627GObject . type_ensure ( WebKit . WebView ) ;
@@ -30,8 +31,16 @@ export async function main([action, ...args]) {
3031
3132 if ( action === "ci" ) {
3233 const filenames = args ;
33- const success = await ci ( { filenames } ) ;
34- return success ? 0 : 1 ;
34+ try {
35+ await ci ( { filenames } ) ;
36+ return 0 ;
37+ } catch ( err ) {
38+ if ( err instanceof Interrupt ) {
39+ return 1 ;
40+ } else {
41+ throw err ;
42+ }
43+ }
3544 }
3645
3746 const [ language_id , ...filenames ] = args ;
@@ -66,19 +75,27 @@ export async function main([action, ...args]) {
6675 } ) ;
6776 }
6877
69- let success = false ;
70-
71- if ( action === "lint" ) {
72- success = await lint ( { filenames, lang, lspc, ci : false } ) ;
73- } else if ( action === "check" ) {
74- success = await lint ( { filenames, lang, lspc, ci : true } ) ;
75- } else if ( action === "format" ) {
76- success = await format ( { filenames, lang, lspc } ) ;
77- } else {
78- printerr ( `Unknown action "${ action } "}` ) ;
78+ try {
79+ if ( action === "lint" ) {
80+ await lint ( { filenames, lang, lspc, ci : false } ) ;
81+ return 0 ;
82+ } else if ( action === "check" ) {
83+ await lint ( { filenames, lang, lspc, ci : true } ) ;
84+ return 0 ;
85+ } else if ( action === "format" ) {
86+ await format ( { filenames, lang, lspc } ) ;
87+ return 0 ;
88+ } else {
89+ printerr ( `Unknown action "${ action } "}` ) ;
90+ return 1 ;
91+ }
92+ } catch ( err ) {
93+ if ( err instanceof Interrupt ) {
94+ return 1 ;
95+ } else {
96+ throw err ;
97+ }
7998 }
80-
81- return success ? 0 : 1 ;
8299}
83100
84101const application = new Adw . Application ( ) ;
@@ -133,12 +150,10 @@ async function ci({ filenames }) {
133150
134151 const file_blueprint = demo_dir . get_child ( "main.blp" ) ;
135152 if ( file_blueprint . query_exists ( null ) ) {
136- const result = await blueprint ( {
153+ ( { template , builder , blueprint_object_ids } = await blueprint ( {
137154 file : file_blueprint ,
138155 lspc : lsp_clients . blueprint ,
139- } ) ;
140- if ( result === false ) return ;
141- ( { template, builder, blueprint_object_ids } = result ) ;
156+ } ) ) ;
142157 }
143158
144159 const file_css = demo_dir . get_child ( "main.css" ) ;
@@ -195,8 +210,6 @@ async function ci({ filenames }) {
195210 } ) ,
196211 ) ;
197212 }
198-
199- return true ;
200213}
201214
202215const key_file = new GLib . KeyFile ( ) ;
0 commit comments