@@ -318,6 +318,49 @@ func TestBubblewrapClearsUnlistedEnvironmentVariables(t *testing.T) {
318318 assert .Equal (t , "sandbox-user" , lines [1 ], "allowlisted env var should be forwarded" )
319319}
320320
321+ func TestBubblewrapForwardsItchioAndTempEnvironmentVariables (t * testing.T ) {
322+ bwrapPath := skipIfNoBubblewrap (t )
323+
324+ var stdout bytes.Buffer
325+ params := newBubblewrapParams (
326+ t ,
327+ bwrapPath ,
328+ "env" ,
329+ "ITCHIO_API_KEY" ,
330+ "ITCHIO_API_KEY_EXPIRES_AT" ,
331+ "ITCHIO_OFFLINE_MODE" ,
332+ "ITCHIO_SANDBOX" ,
333+ "TMP" ,
334+ "TEMP" ,
335+ "TMPDIR" ,
336+ )
337+ params .Stdout = & stdout
338+ params .Env = []string {
339+ "ITCHIO_API_KEY=subkey-123" ,
340+ "ITCHIO_API_KEY_EXPIRES_AT=1735689600" ,
341+ "ITCHIO_OFFLINE_MODE=1" ,
342+ "ITCHIO_SANDBOX=1" ,
343+ "TMP=/game/.itch/temp" ,
344+ "TEMP=/game/.itch/temp" ,
345+ "TMPDIR=/game/.itch/temp" ,
346+ }
347+
348+ r , err := runner .GetRunner (params )
349+ require .NoError (t , err )
350+ require .NoError (t , r .Prepare ())
351+ require .NoError (t , r .Run ())
352+
353+ lines := strings .Split (strings .TrimSuffix (stdout .String (), "\n " ), "\n " )
354+ require .Len (t , lines , 7 )
355+ assert .Equal (t , "subkey-123" , lines [0 ])
356+ assert .Equal (t , "1735689600" , lines [1 ])
357+ assert .Equal (t , "1" , lines [2 ])
358+ assert .Equal (t , "1" , lines [3 ])
359+ assert .Equal (t , "/game/.itch/temp" , lines [4 ])
360+ assert .Equal (t , "/game/.itch/temp" , lines [5 ])
361+ assert .Equal (t , "/game/.itch/temp" , lines [6 ])
362+ }
363+
321364func TestBubblewrapContextCancellation (t * testing.T ) {
322365 bwrapPath := skipIfNoBubblewrap (t )
323366
0 commit comments