@@ -106,6 +106,7 @@ function isLoggedIn() {
106106 encoding : 'utf-8' ,
107107 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
108108 timeout : 10_000 ,
109+ windowsHide : true ,
109110 } ) ;
110111 return out && ! out . toLowerCase ( ) . includes ( 'not logged in' ) ;
111112 } catch {
@@ -119,6 +120,7 @@ function getLoginInfo() {
119120 encoding : 'utf-8' ,
120121 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
121122 timeout : 10_000 ,
123+ windowsHide : true ,
122124 } ) ;
123125 return parseLoginInfo ( out ) ;
124126 } catch {
@@ -148,6 +150,7 @@ function deviceCodeLogin(cmd) {
148150 return new Promise ( ( resolve , reject ) => {
149151 const proc = spawn ( cmd , [ 'user' , 'login' , '-e' , '-d' ] , {
150152 stdio : [ 'inherit' , 'pipe' , 'pipe' ] ,
153+ windowsHide : true ,
151154 } ) ;
152155
153156 let gotOutput = false ;
@@ -197,7 +200,7 @@ function deviceCodeLogin(cmd) {
197200function findDevtunnel ( ) {
198201 // Try devtunnel directly
199202 try {
200- execSync ( 'devtunnel --version' , { stdio : 'pipe' } ) ;
203+ execSync ( 'devtunnel --version' , { stdio : 'pipe' , windowsHide : true } ) ;
201204 return 'devtunnel' ;
202205 } catch { }
203206
@@ -222,7 +225,7 @@ function findDevtunnel() {
222225 ) ;
223226 if ( fs . existsSync ( homeBin ) ) {
224227 try {
225- execFileSync ( homeBin , [ '--version' ] , { stdio : 'pipe' } ) ;
228+ execFileSync ( homeBin , [ '--version' ] , { stdio : 'pipe' , windowsHide : true } ) ;
226229 return homeBin ;
227230 } catch { }
228231 }
@@ -253,6 +256,7 @@ function isTunnelValid(id) {
253256 execFileSync ( devtunnelCmd , [ 'show' , id , '--json' ] , {
254257 encoding : 'utf-8' ,
255258 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
259+ windowsHide : true ,
256260 } ) ;
257261 return true ;
258262 } catch {
@@ -273,7 +277,7 @@ function checkTunnelHealth() {
273277 execFile (
274278 devtunnelCmd ,
275279 [ 'show' , tunnelId ] ,
276- { encoding : 'utf-8' , signal : abortCtrl . signal } ,
280+ { encoding : 'utf-8' , signal : abortCtrl . signal , windowsHide : true } ,
277281 ( err , stdout ) => {
278282 clearTimeout ( timer ) ;
279283
@@ -401,6 +405,7 @@ function killTunnelProc() {
401405 execFileSync ( 'taskkill' , [ '/pid' , String ( tunnelProc . pid ) , '/T' , '/F' ] , {
402406 stdio : 'pipe' ,
403407 timeout : 5000 ,
408+ windowsHide : true ,
404409 } ) ;
405410 } catch {
406411 /* best effort */
@@ -566,6 +571,7 @@ function scheduleRestart() {
566571function hostTunnel ( ) {
567572 const hostProc = spawn ( devtunnelCmd , [ 'host' , tunnelId ] , {
568573 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
574+ windowsHide : true ,
569575 } ) ;
570576 tunnelProc = hostProc ;
571577
@@ -657,7 +663,11 @@ async function startTunnel(port, options = {}) {
657663 if ( ! loggedIn ) {
658664 log . info ( 'Logging in to DevTunnel with Microsoft Entra (recommended for long sessions)...' ) ;
659665 try {
660- execFileSync ( devtunnelCmd , [ 'user' , 'login' , '-e' ] , { stdio : 'inherit' , timeout : 30000 } ) ;
666+ execFileSync ( devtunnelCmd , [ 'user' , 'login' , '-e' ] , {
667+ stdio : 'inherit' ,
668+ timeout : 30000 ,
669+ windowsHide : true ,
670+ } ) ;
661671 } catch {
662672 log . info ( 'Browser login failed or unavailable, falling back to device code flow...' ) ;
663673 log . info ( 'A code will be displayed — open the URL on any device to authenticate.' ) ;
@@ -694,6 +704,7 @@ async function startTunnel(port, options = {}) {
694704 }
695705 const createOut = execFileSync ( devtunnelCmd , [ 'create' , '--expiration' , '30d' , '--json' ] , {
696706 encoding : 'utf-8' ,
707+ windowsHide : true ,
697708 } ) ;
698709 const tunnelData = JSON . parse ( createOut ) ;
699710 tunnelId = tunnelData . tunnel . tunnelId ;
@@ -706,6 +717,7 @@ async function startTunnel(port, options = {}) {
706717 // Ephemeral tunnel — create fresh, will be deleted on shutdown
707718 const createOut = execFileSync ( devtunnelCmd , [ 'create' , '--expiration' , '1d' , '--json' ] , {
708719 encoding : 'utf-8' ,
720+ windowsHide : true ,
709721 } ) ;
710722 const tunnelData = JSON . parse ( createOut ) ;
711723 tunnelId = tunnelData . tunnel . tunnelId ;
@@ -717,7 +729,7 @@ async function startTunnel(port, options = {}) {
717729 execFileSync (
718730 devtunnelCmd ,
719731 [ 'port' , 'create' , tunnelId , '-p' , String ( port ) , '--protocol' , 'http' ] ,
720- { stdio : 'pipe' } ,
732+ { stdio : 'pipe' , windowsHide : true } ,
721733 ) ;
722734 } catch { }
723735 // Set tunnel access: public (anonymous) or private (owner-only via Microsoft login)
@@ -726,7 +738,7 @@ async function startTunnel(port, options = {}) {
726738 execFileSync (
727739 devtunnelCmd ,
728740 [ 'access' , 'create' , tunnelId , '-p' , String ( port ) , '--anonymous' ] ,
729- { stdio : 'pipe' } ,
741+ { stdio : 'pipe' , windowsHide : true } ,
730742 ) ;
731743 } catch { }
732744 log . info ( 'Tunnel access: public (anonymous)' ) ;
@@ -735,6 +747,7 @@ async function startTunnel(port, options = {}) {
735747 try {
736748 execFileSync ( devtunnelCmd , [ 'access' , 'reset' , tunnelId ] , {
737749 stdio : 'pipe' ,
750+ windowsHide : true ,
738751 } ) ;
739752 } catch { }
740753 log . info ( 'Tunnel access: private (owner-only via Microsoft login)' ) ;
@@ -773,7 +786,11 @@ function cleanupTunnel() {
773786 log . info ( 'Tunnel host stopped (tunnel preserved for reuse)' ) ;
774787 } else {
775788 try {
776- execFileSync ( devtunnelCmd , [ 'delete' , id , '-f' ] , { stdio : 'pipe' , timeout : 10000 } ) ;
789+ execFileSync ( devtunnelCmd , [ 'delete' , id , '-f' ] , {
790+ stdio : 'pipe' ,
791+ timeout : 10000 ,
792+ windowsHide : true ,
793+ } ) ;
777794 log . info ( 'Tunnel cleaned up' ) ;
778795 } catch {
779796 /* best effort — tunnel will expire on its own */
0 commit comments