File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ import { uriUtils } from '../utils/util';
99export * from './vscode-dosbox' ;
1010
1111export interface AsmResult {
12- message ? : string ,
12+ message : string ,
1313 error ?: number ,
14- warn ?: number
14+ warn ?: number ,
15+ [ id : string ] : unknown ,
1516}
1617
1718export interface ActionContext {
Original file line number Diff line number Diff line change @@ -114,8 +114,8 @@ export class Dosbox implements ExecAction {
114114
115115 let result = undefined ;
116116
117+ const [ hook , promise ] = messageCollector ( ) ;
117118 if ( ctx . actionType !== conf . ActionType . open && USE_NODEFS_WATCH ) {
118- const [ hook , promise ] = messageCollector ( ) ;
119119 nodefs . watchFile ( logUri . fsPath , ( ) => {
120120 try {
121121 if ( nodefs . existsSync ( logUri . fsPath ) ) {
@@ -127,24 +127,25 @@ export class Dosbox implements ExecAction {
127127 console . error ( e ) ;
128128 }
129129 } ) ;
130- promise . then ( val => {
131- console . log ( val ) ;
132- result = val ;
133- } ) ;
134130 }
135131
136132 await box . run ( ) . catch ( e => {
137133 console . error ( "dosbox run error" , e ) ;
134+ throw new Error ( e ) ;
138135 } ) ;
139136
140137 if ( result === undefined ) {
141138 if ( nodefs . existsSync ( logUri . fsPath ) ) {
142139 result = nodefs . readFileSync ( logUri . fsPath , { encoding : 'utf-8' } ) ;
140+ hook ( result ) ;
143141 }
144142 }
143+
144+ const message = await promise ;
145+
145146 if ( result === undefined ) {
146147 throw new Error ( "can't get dosbox's result" + logUri . fsPath ) ;
147148 }
148- return { message : result } ;
149+ return { message, result } ;
149150 }
150151}
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import { messageCollector } from "../diagnose/messageCollector";
1010export class JsdosWeb implements ExecAction {
1111 name : DosEmulatorType | DosEmulatorType [ ] = DosEmulatorType . jsdos ;
1212 async run ( context : ExtensionContext , ctx : ActionContext , api : API ) : Promise < AsmResult > {
13- let result = undefined ;
1413 await api . jsdos . jszip . loadAsync ( ctx . bundleData ) ;
1514
1615 let fileInJsdos = "" ;
@@ -67,8 +66,9 @@ export class JsdosWeb implements ExecAction {
6766 break ;
6867 }
6968 } ) ;
70- result = await promise ;
69+ const message = await promise ;
70+ return { message, webview } ;
7171 }
72- return { message : result } ;
72+ throw new Error ( "can't get message from" + this . name ) ;
7373 }
7474}
You can’t perform that action at this time.
0 commit comments