File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 104104.tern-port
105105
106106* bak *
107+ * .out
Original file line number Diff line number Diff line change 11// using NodeJS' assert library to test flug
2- const assert = require ( "assert" ) ;
3- const child_process = require ( "child_process" ) ;
2+ const assert = require ( "node:assert" ) ;
3+ const child_process = require ( "node:child_process" ) ;
4+ const fs = require ( "node:fs" ) ;
45
56const $ = str => {
6- const output = child_process . execSync ( str + " 2>&1" , { cwd : __dirname } ) . toString ( ) ;
7- // console.log("output:", output);
8- return output ;
7+ try {
8+ const output = child_process . execSync ( str + " 2>&1" , {
9+ cwd : __dirname ,
10+ stdio : [
11+ 0 ,
12+ fs . openSync ( 'log.out' , 'w' ) ,
13+ fs . openSync ( 'err.out' , 'w' )
14+ ]
15+ } ) . toString ( ) ;
16+ return output ;
17+ } catch ( error ) {
18+ const msg = fs . readFileSync ( 'log.out' , 'utf-8' ) ;
19+ return msg ;
20+ }
921} ;
1022
1123const t = ( cmd , expected ) => {
You can’t perform that action at this time.
0 commit comments