File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
skills/analysis/home-security-benchmark/scripts Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ Tests: 131 total (96 LLM + 35 VLM) across 16 suites
7373 process . exit ( 0 ) ;
7474}
7575
76+
7677// Parse skill parameters if running as Aegis skill
7778let skillParams = { } ;
7879try { skillParams = JSON . parse ( process . env . AEGIS_SKILL_PARAMS || '{}' ) ; } catch { }
@@ -1825,8 +1826,13 @@ async function main() {
18251826 process . exit ( failed > 0 ? 1 : 0 ) ;
18261827}
18271828
1828- // Only run when executed directly (not when require()'d for syntax/import checks)
1829- if ( require . main === module ) {
1829+ // Run when executed directly — supports both plain Node and Electron spawn.
1830+ // `require.main === module` works for `node script.cjs`.
1831+ // `process.argv[1]` check handles `spawn(electronBinary, [scriptPath])`.
1832+ const isDirectRun = require . main === module ||
1833+ ( process . argv [ 1 ] && require ( 'path' ) . resolve ( process . argv [ 1 ] ) === __filename ) ;
1834+
1835+ if ( isDirectRun ) {
18301836 main ( ) . catch ( err => {
18311837 log ( `Fatal: ${ err . message } ` ) ;
18321838 emit ( { event : 'error' , message : err . message } ) ;
You can’t perform that action at this time.
0 commit comments