File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,10 +41,16 @@ jobs:
4141 os : { name: Ubuntu, value: ubuntu-24.04 }
4242 use_psych : true
4343
44+ - ruby : { name: no symlinks, value: 4.0.0 }
45+ os : { name: Windows, value: windows-2025 }
46+ symlink : off
4447 env :
4548 RUBYGEMS_USE_PSYCH : ${{ matrix.use_psych || 'false' }}
4649
4750 steps :
51+ - name : disable development mode on Windows
52+ run : powershell -c "Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 0"
53+ if : matrix.symlink == 'off'
4854 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4955 with :
5056 persist-credentials : false
5561 bundler : none
5662 - name : Install Dependencies
5763 run : bin/rake setup
64+ - name : Run Test with non-Admin user
65+ run : |
66+ gem inst win32-process --no-doc --conservative
67+ ruby bin/windows_run_as_user ruby -S rake test
68+ if : matrix.symlink == 'off'
5869 - name : Run Test
5970 run : bin/rake test
60- if : matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby'
71+ if : matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby' && matrix.symlink != 'off'
6172 - name : Run Test isolatedly
6273 run : bin/rake test:isolated
6374 if : matrix.ruby.name == '3.4' && matrix.os.name != 'Windows'
Original file line number Diff line number Diff line change 1+ require "win32/process"
2+ require "rbconfig"
3+
4+ TESTUSER = "testuser"
5+
6+ system("net user #{TESTUSER} /del 2>NUL")
7+ system("net user #{TESTUSER} \"Password123+\" /add") || raise
8+ system("icacls . /grant #{TESTUSER}:(OI)(CI)(IO)(F)")
9+
10+ stdout_read, stdout_write = IO.pipe
11+ cmd = ARGV.join(" ")
12+ env = {
13+ "TMP" => "#{Dir.pwd}/tmp",
14+ "TEMP" => "#{Dir.pwd}/tmp"
15+ }
16+ pinfo = Process.create command_line: cmd,
17+ with_logon: TESTUSER,
18+ password: "Password123+",
19+ cwd: Dir.pwd,
20+ environment: ENV.to_h.merge(env).map{|k,v| "#{k}=#{v}" },
21+ startup_info: { stdout: stdout_write, stderr: stdout_write }
22+
23+ stdout_write.close
24+ out = stdout_read.read
25+ puts out
26+
27+ # Wait for process to terminate
28+ sleep 0.1 while !(ecode=Process.get_exitcode(pinfo.process_id))
29+
30+ exit ecode
You can’t perform that action at this time.
0 commit comments